This repo contains exercises to help you get started developing in OCaml.
On Linux, macOS, *BSD
$ bash -c "sh <(curl -fsSL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh)"
$ opam init -ya
$ eval $(opam env)
On Windows
$ wiget install Git.git
$ winget install OCaml.opam
$ opam init -ya
opam install ocaml-lsp-server odoc ocamlformat utop async core js_of_ocaml js_of_ocaml-ppx merlin ocp-indent
- Install vscode.
- Install vscode ocaml platform.
The directory 01-exercises
contains a number of exercises to get you started
with OCaml. Each one has some expect-tests embedded in it. Get started with
$ cd 01-exercises
$ dune build
And then, for each <problem_dir>
under 01-exercises
, do:
$ cd <problem_dir>
$ dune runtest
dune runtest
builds and runs the inline tests. Look at the test output and
compiler errors, edit problem.ml
and rerun dune runtest
until all the tests
pass.
Adapted from https://github.com/janestreet/learn-ocaml-workshop.