query
On this page

range

lib.range

Docs pulled from | This Revision | about 2 hours ago


Return a list of integers from first up to and including last.

Inputs

first

First integer in the range

last

Last integer in the range

Type

range :: int -> int -> [int]

Examples

lib.lists.range usage example

range 2 4
=> [ 2 3 4 ]
range 3 2
=> [ ]
(lib.lists.range)

Noogle detected

Aliases

Implementation

The following is the current implementation of this function.

range =
    first:
    last:
    if first > last then
      []
    else
      genList (n: first + n) (last - first + 1);