The syntax makes ReasonML easy to start playing with, but unless you already know a typed functional language, you will soon run into stumbling blocks because of unfamiliarity with static types and functional programming.
Fear not! Work through these exercises and learn all the basics - defining and using functions, understanding recursion, lists, list operations, variants, and all the way till mutable variables. They will give you a great foundation to start mastering this beautiful language.
These exercises are originally from a workshop organized by Jane Street for teaching
OCaml to programmers who work in other languages and who do not necessarily have experience with functional languages. Link to the original repo. We adapted the tutorials and exercise code to the Reason syntax and toolchain.
Install reason-cli globally.
Clone this repository, and run
The exercises are numerically ordered and can be found in the
Start by opening the first exercise in a text editor -
src/exercises/01-introduction/introduction.re. It will tell you where to go from there.
All exercises except the first one comes with a test. Run them as you complete each exercise. For example for the second exercise, run its test with:
.bs.js file is your Reason program (
.bs stands for the bucklescript compiler. The
You can also run
./run_tests which will run all the tests automatically for you and stop at the first failing one.