LazyFor → `Kernel.SpecialForms.for/1` but returning stream

Slightly moving forward. Simple binary comprehension and options (all but :reduce) do work.

iex|1 ▶ Enum.to_list(stream <<x <- "abcabca">>, do: x)
'abcabca'
iex|2 ▶ Enum.to_list(stream <<x <- "abcabca">>, uniq: true, do: x)
'abc'
iex|3 ▶ stream <<x <- "abcabca">>, take: 2, do: x                 
'ab'

Also :into works as a side effect (as described here)

I am not sure I am into implementing full bitstring support, but :reduce will come soon.

4 Likes