Skip to content

Instantly share code, notes, and snippets.

@kjellski
Created March 25, 2015 22:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kjellski/156f644f3ef1130ee496 to your computer and use it in GitHub Desktop.
Save kjellski/156f644f3ef1130ee496 to your computer and use it in GitHub Desktop.
last
let rec last (l: 'a list) : 'a Option =
match l with
| [] -> None
| [x] -> Some x
| x::xs -> last xs
let list = ["a";"a";"a";"a";"b";"c";"c";"a";"a";"d";"d";"e";"e";"e";"e"]
string list
last list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment