Created
March 25, 2015 22:40
-
-
Save kjellski/156f644f3ef1130ee496 to your computer and use it in GitHub Desktop.
last
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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