Reverse a list in haskell

You are separating the list into head and tail, but then re-assemble the list in the same order. Take the list [1, 2, 3] for example:

In the first call, x will be 1, and xs will be [2, 3]. Then you create a new list, consisting of x (so 1) at the front, followed by reverseList [2, 3].

Leave a Comment

tech