Elixir: Stream.chunk_every/4 gives odd results

Created on 8 Dec 2017  路  3Comments  路  Source: elixir-lang/elixir

I am very new to Elixir, and so looking at chunk_every when argument step is more than count.

Erlang/OTP 20 [erts-9.0] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10]

Interactive Elixir (1.5.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(17)> Enum.chunk_every('ABCDEFGHIJK', 3, 4, [])
['ABC', 'EFG', 'IJK', 'IJK']
iex(18)> Enum.chunk_every('ABCDEFGHIJKL', 3, 4, [])
['ABC', 'EFG', 'IJK']
iex(19)>

The output with 'IJK' repeated does not seem of much use?

Thanks.

(Copied from Reddit here)

Elixir Bug Intermediate

All 3 comments

@josevalim may I take care of this one?

@albertoalmagro yes please! If it is not assigned and nobody "claimed" it, you should be good to go!

This came about because I was so impressd, I decided to do a version in Python, and noticed the above in my testing.

My blog post is: Elixirs' chunk_every in Python.

Was this page helpful?
0 / 5 - 0 ratings