Skip to content

Stream.chunk_every/4 gives odd results #7096

@Paddy3118

Description

@Paddy3118

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions