Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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>
Source by ocaml.org #
 
PREVIOUS NEXT
Tagged: #ocaml #returns #element #list
ADD COMMENT
Topic
Name
2+9 =