Skip to content

janestreet/learn-ocaml-workshop

Repository files navigation

Jane Street OCaml Workshop

This repo contains exercises and build instructions to help you get started developing in OCaml.

Installing build tools and libraries

See README.org in install-ocaml for instructions.

Exercises

The exercises directory contains a number of exercises to get you started with OCaml. Each one has some expect-tests embedded in it. The workflow is:

cd 02-exercises/$problem_dir

dune runtest # builds and runs inline tests
# Look at test output and compiler errors, edit problem.ml, rerun:
dune runtest

Snake, Lumines, and Frogger

Once you’re done with the exercises, you can also implement simplified clones of the following arcade games:

  • snake (runs on your computer)
  • lumines (runs on your computer)
  • frogger (runs in a web browser)

Async

The OCaml standard library has various low-level calls for working with sockets in the Unix module and Jane Street’s Core library wraps all of those. But, if you want your program to be able to wait for multiple events at the same time, you likely want to be able to program concurrently.

One library for writing code in this style is Async. Async provides Reader and Writer abstractions for I/O which, paired with the Tcp module should have most of what you need for either of the projects below.

Before proceeding, it would probably be a good idea to read Chapter 18 of Real World OCaml. There is some example code in the next section which should set you on your way.

Bigger projects

Once you’ve made it to this point, there are a few possible paths laid out for you:

  • You can work on writing a bot for a chat protocol called IRC. See the irc-bot README to get started!
  • You can work on writing your very own version of fzf in OCaml. See the fuzzy-finder README to get started!
  • Or, if you want, you can continue making improvements and extensions to your version of Frogger (see the frogger README for some ideas).

Documentation and resources

OCaml

Jane Street libraries and tools

dune

About

Exercises and projects for Jane Street's OCaml Workshop

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages