Reversing a List: Using if
fun rev lst = if lst = nil then nil
else rev(tl(lst))@[hd(lst)];
val rev : fn ''a list -> ''a list
val it = [4, 3, 2, 1] : int list
rev [“nice”, “feature”, “recursion”];
val it = [“recursion”, “feature”, “nice”] : string list
Error: operator and operand don’t agree (equality type required)