> IMHO, a range(together with its now established stepping capability) is 
but syntactic sugar

This is true, but in Elixir a range is syntactic sugar specifically for a 
*compile-time* list of integers. This is what lets it be used in guards and 
pattern matching, where streams (and non-literal enumerables, and 
comprehensions) cannot be employed.

So ranges are meant for bounded compile-time integer sequences, stream is 
useful for building lazy infinite runtime ones, and the two have very 
different intended usecases. :)

On Tuesday, April 6, 2021 at 5:55:53 PM UTC-7 [email protected] wrote:

> Wouldn’t it be better to use `Stream.iterate/2` than try to embed this
>> into a data structure?
>
> It is certainly possible, but would the same argument not also apply to 
> the original proposal where for-comprehension could be resorted to instead?
>
> IMHO, a range(together with its now established stepping capability) is 
> but syntactic sugar. (Syntactic sugar causes cancer of the semi-colons 
> though!!!)
>
> I feel a strong case can be made to extend this syntactic sugar to a 
> Stream, which is also but an enumerable at the end of the day.
> The conciseness of `13..∞//13` without sacrificing readability I would say 
> is very appealing here. (Does anyone feel differently about this?)
>
> Besides readability, is there another concern I fail to see on account of 
> which it is best to stick with a `Stream.iterate`?
>

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/d39dc430-97ef-4935-be48-58bc5174a322n%40googlegroups.com.

Reply via email to