Misha Moroshko
Misha Moroshko

Reputation: 171369

Where are the docs of the [a..b] syntax for creating Lists in Elm?

Where could I find the definition/documentation of the [a..b] syntax for creating Lists in Elm?

Upvotes: 3

Views: 117

Answers (2)

mgold
mgold

Reputation: 6366

This syntax was removed in Elm 0.18. Use List.range instead. Some examples from elm-repl:

> List.range 1 5
[1,2,3,4,5] : List Int
> List.range 1 1
[1] : List Int
> List.range 1 0
[] : List Int
> List.range 1 5 |> List.map (\x -> x*2)
[2,4,6,8,10] : List Int
> List.range 1 5 |> List.map (\x -> x*2 - 1)
[1,3,5,7,9] : List Int
> let b = 5 in b |> List.range 1
[1,2,3,4,5] : List Int

Note: I have completely removed my previous answer because it was made obsolete by Elm 0.18.

Upvotes: 3

avh4
avh4

Reputation: 2655

Currently the only official documentation is the brief mention in the "Lists" section of the syntax reference: http://elm-lang.org/docs/syntax#lists

Upvotes: 3

Related Questions