enumerate


enumerate(start, end, @key next = inc, compare = number_is_lteq)
      

Return a sequence of values from start to end (both inclusive). Next must be a function that when called with the current element added to the result, return the following element. Compare is the predicate used to determine when to stop generating new elements.

Examples:


enumerate(1, 10)
// 1:<promise>
fifth(enumerate(1, 10))
// 5

let s = enumerate(1, 5, compare = number_is_lt, next = ^(x) x + 2)
fourth(s)
// false
second(s)
// 3
      

Also see:

range
realize


Core Module Index | Contents