how to get the value of the last element of a List? I\'ve noted that List.hd (or .Head) return an item, while List.tl (or .Tail) returns a List.
Is rev the List and
A quick & dirty way of doing it is by using List.reduce. Assuming the list is called ls,
ls
let lastElement ls = List.reduce (fun _ i -> i) ls
As for efficiency, I agree with Pavel.