Hacker News new | ask | show | jobs
by ahf8Aithaex7Nai 240 days ago
Just write 'for' and 'while' yourself if you need it. Here is ‘for’ in Elm/Gren:

    for : Int -> Int -> Int -> (Int -> msg) -> List msg
    for start stop step action =
        let
            range =
                if step > 0
                then List.range start (step) (stop - 1)
                else if step < 0
                then List.range stop (abs step) (start - 1) |> List.reverse
                else []
        in
            List.map action range

It should be just as trivial to write this in Gleam.