nikic / iter

Iteration primitives using generators
Other
1.12k stars 76 forks source link

Support for implode on iterators #13

Closed camspiers closed 10 years ago

camspiers commented 10 years ago

Takes an iterable and joins its elements with a string

Examples:

  iter\implode(new \ArrayIterator(['a', 'b', 'c']), ',')
  => "a,b,c"
camspiers commented 10 years ago

I like it. I will implement that and update the PR (with rebase)

camspiers commented 10 years ago

Done @nikic

nikic commented 10 years ago

That was fast!

One last question: Do you think it's better to stick with the "classic" PHP implode name, or use the join alias instead, that is used by all other languages?

camspiers commented 10 years ago

Ooo, good question. I like join as it is shorter. But let me know what you like.

nikic commented 10 years ago

Merged using join name. Also swapped order of arguments to be consistent with PHP and most other iter functions (which have the iterator as the second arg).

camspiers commented 10 years ago

Awesome!

On Friday, 31 January 2014, Nikita Popov notifications@github.com wrote:

Merged using join name. Also swapped order of arguments to be consistent with PHP and most other iter functions (which have the iterator as the second arg).

— Reply to this email directly or view it on GitHubhttps://github.com/nikic/iter/pull/13#issuecomment-33747730 .