Created
May 7, 2011 06:55
-
-
Save philtomson/960272 to your computer and use it in GitHub Desktop.
reverse_words in a string (OCaml)
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 reverse_words str = | |
let slst = Str.split (Str.regexp_string " ") str in | |
List.fold_left (fun accum i -> accum ^ " " ^ i) " " (List.rev slst) ;; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment