Answers for "ocaml returns the last element of a list"

0

ocaml returns the last element of a list

# let rec last = function
    | [] -> None
    | [x] -> Some x
    | _ :: t -> last t;;val last : 'a list -> 'a option = <fun>
Posted by: Guest on October-11-2021

Code answers related to "ocaml returns the last element of a list"

Python Answers by Framework

Browse Popular Code Answers by Language