Skip to content

Instantly share code, notes, and snippets.

@dacr
Last active April 2, 2023 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dacr/d6eca4121126aad677024f3280ab13f1 to your computer and use it in GitHub Desktop.
Save dacr/d6eca4121126aad677024f3280ab13f1 to your computer and use it in GitHub Desktop.
ocaml cheat sheet / published by https://github.com/dacr/code-examples-manager #c0e2dcaf-f992-4b0a-b0bd-551a7734ee3b/6cd621db83a1cf01c4d4eb114e7883d84a3f580f

OCAML

getting started

OCAML install

sudo apt-get install opam
opam init

eval $(opam env)
which ocaml
ocaml --version

opam switch list-available
opam switch create 4.14.0
eval $(opam env)
which ocaml
ocaml --version

REPL & SCRIPTING

opam install utop
utop

A script named : hello.ml

#!/usr/bin/env utop
(* simple example script *)
let x= 42;;
Printf.printf "the response is %d " x ;;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment