99 Elm Problems/Problem 5/Solutions
Appearance
Solution 1: Recursive version
myReverse list =
case list of
[] -> []
head :: tail -> myReverse tail ++ [ head ]
Solution 2: Using List.foldl
myReverse = List.foldl (::) []
Solution 1: Recursive version
myReverse list =
case list of
[] -> []
head :: tail -> myReverse tail ++ [ head ]
Solution 2: Using List.foldl
myReverse = List.foldl (::) []