-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed
Labels
Description
Something akin to Python's range
could make a nice addition to the language as a library or builtin function.
>>> range(0, 8, 2)
[0, 2, 4, 6]
>>> range(3, 5, -1)
[]
>>> range(-3, -5, -1)
[-3, -4]
It would produce an iterable, not a list.
Related discussion on the mailing list https://groups.google.com/forum/?fromgroups=#!topic/elixir-lang-core/HpBIV5zMAHw , continued in the issue #1017.
Both step
and seq
are OK names. Altough, as another alternative, we could rename current ranges to intervals
(it makes just as much sense to talk about inclusiveness and non-inclusiveness of intervals, aka closed intervals and open intervals) and call the new function range
.