Inching Forward

Review: OCaml from the Very Beginning

Jan 8, 2017

OCaml from the Very Beginning is an introductory book on the OCaml programming language by John Whitington. From that link, you can buy the DRM-free e-book for $14.99. For an additional 10 dollars, you can get a bundle of OCaml from the Very Beginning and Mr. Whitington’s second OCaml book OCaml: Algorithms, Methods, and Diversions.

Review

TLDR: This is a great first book to get your feet wet with OCaml.

The first thing that jumps out at you is the succint writing. Simple words are used to teach OCaml, and small chapters dole out mentally-sustainable chunks of OCaml knowledge. The OCaml REPL is introduced immediately and you are encouraged to type in everything you see. After doing this for a few chapters, typing in OCaml becomes familiar.

The pacing of the book felt good. Foundational functional concepts are explained and then built upon in a straightforward manner. At 204 pages, it is a pretty quick read, even when doing the exercises.

Some of what you will learn:

Each chapter ends with a set of exercises, which I am a fan of. I don’t always succeed but I try to do the exercises in an effort to retain more. There is an Answers to Questions section at the back of the book to check your answers against. It feels rewarding to see your solution matching the author’s, but it’s also enlightening to find a simpler answer than the one you came up with. There is also a Hints for Questions section in case you are stuck. I don’t think I’ve ever seen this in a book I’ve read before–I like the idea.

Each chapter also ends with a “So Far” section which very briefly (omitting some concepts completely) summarizes what you’ve learned since the first chapter. I tried forcing myself to read them after trying to skip them completely.

As the title suggests, this is beginning OCaml. It does not cover all OCaml features. The standard library is only very briefly touched on at the end of the book. You will not come away from this book ready to take on the world writing production OCaml. You should come out with a good grasp of OCaml functional programming data structures and algorithms and be familiar with basic features. You should end the book thirsty for more.


#ocaml #books #reviews