If I understood it correctly Elm doesn't have something like list comprehension.
What would you use instead if you for example would like to map the numbers 1 to 100 to something else?
CodePudding user response:
I think List.range and pipeline style read very well togeher. But it is not as succinct as a list comprehension in python.
module Main exposing (main)
import Html
main =
List.range 1 10
|> List.map square
|> List.map String.fromInt
|> String.join ", "
|> Html.text
square : Int -> Int
square a =
a ^ 2