Skip to content

Instantly share code, notes, and snippets.

@lindig
Created September 7, 2015 09:43
Show Gist options
  • Save lindig/e1afdf385af1ba9cab35 to your computer and use it in GitHub Desktop.
Save lindig/e1afdf385af1ba9cab35 to your computer and use it in GitHub Desktop.
hello.ml - discussion about using open in OCaml
let rec join = function
| [] -> ""
| [x] -> x
| [x;y] -> x^" and "^y
| x::xs -> x ^ ", " ^ join xs
let main () =
let argv = Array.to_list Sys.argv in
let args = List.tl argv in
match args with
| [] -> Printf.printf "Hello, world!\n"
| names -> Printf.printf "Hello, %s!\n" (join names)
let () = main ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment