Created
October 17, 2013 19:24
Revisions
-
Tonkpils created this gist
Oct 17, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ fun get_nth (words : string list, n : int) = if n = 1 then (hd words) else get_nth((tl words), n - 1) fun date_to_string(date : int*int*int) = let val months = ["January", "February", "March", "April", "June", "July", "August", "September", "October", "November", "December"] val month = get_nth(months, #2 date) in month ^ " " ^ Int.toString(#3 date) ^ ", " ^ Int.toString(#1 date) end (* Find the error...*) (* - date_to_string((2013, 6, 1)) = "June 1, 2013" *) (* val it = false : bool *) (* - date_to_string((2013, 6, 1)); *) (* val it = "July 1, 2013" : string *)