Skip to content

Instantly share code, notes, and snippets.

@jkone27
Created February 25, 2024 12:54
Show Gist options
  • Save jkone27/bca319ed6fc210c286858efa9678f927 to your computer and use it in GitHub Desktop.
Save jkone27/bca319ed6fc210c286858efa9678f927 to your computer and use it in GitHub Desktop.
ocaml sample file for comparison with F#
module Test = struct
let hello world =
"hello " ^ world
end
let lst =
[
"world";
"john";
"BUG";
"mary"
]
|> List.filter (fun x -> x <> "BUG")
|> List.map Test.hello
let () =
lst |> List.iter print_endline;
lst
|> List.fold_left (fun acc elem -> elem ^ "," ^ acc) ""
|> print_endline
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment