99 Elm Problems/Problem 5

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Elm provides the function List.reverse to reverse the order of elements in a list. See if you can implement it.

import Html exposing (text)
import List

myReverse: List a -> List a
-- your implementation goes here

main =
  text (toString (myReverse (List.range 1 4)))

Result:

[4, 3, 2, 1]

Solutions