Skip to content

Latest commit

 

History

History
18 lines (15 loc) · 351 Bytes

README.md

File metadata and controls

18 lines (15 loc) · 351 Bytes

Reverse a list

Write a function to reverse the the elements of a list, with the following type:

val rev : 'a list -> 'a list = <fun>

For example:

rev [1;2;3;4;5] ;;
- : int list = [5; 4; 3; 2; 1]

Hint: recall the operator @ that concatenates two lists:

[1;2;3] @ [4;5] 
- : int list = [1; 2; 3; 4; 5]