OCaml from the Very Beginning

Author: John Whitington
Publisher: Coherent Press
Pages: 204
ISBN: 978-0957671102
Audience:  OCaml beginners
Rating: 4.5
Reviewer: Mike James

OCaml is an odd language. Especially if you are coming from a background in the Java-like languages. A book that promises to take you from the very beginning should be helpful.

OCaml is a functional language but some regard it as the easiest and most practical of the functional languages. Even so you do have to think a little differently to get into the way of using it effectively.

This book as about the most gentle introduction to OCaml you could imagine. It is almost, but not quite, suitable for the non-programmer. It does introduce the ideas in a way that don't depend on other programming concepts, but I suspect that a complete beginner will be a bit mystified in places. A much better reader is someone who has a slight experience of a traditional language, 

The absolute worst reader for this book is anyone who already knows a functional language or worse considers themselves an expert on one - this book is not for you. Many beginners books often can't ignore the temptations to write sections that are actually aimed at the author's peers in an effort to show how clever the author is. This may be good for the author but it is usually terrible for the targeted reader. The good news is that this particular book is always aimed at the beginner and moves through a set of logical levels to get through the subject with as little pain as possible. 

The book has sixteen chapters that take you from the very basics of using OCaml from the command line  through to using the standard library and creating modules. Each chapter comes with an ever growing summary of what you should know at that point in the book - this really helps.




In the first chapter John Whitington gets you started with some simple interactive work. The pace is very gentle but say awake because occasionally key ideas are introduced and you might just miss them. If you find you are a bit lost simply back up and find what you missed because as far as I can tell there are no omissions.

Chapters 2 and 3 get into the basics of creating useful functions. This is where you start to encounter some of OCaml's differences from other languages such as pattern matching rather than explicit if statements. Chapter 4 takes us on a tour of OCaml's most important data type - the list. 

Chapter 5 looks at the problem of sorting things but from OCaml's point of view. Chapter 6 is more on functions and in particular functions as parameters to other functions. This is where we discover map and anonymous functions. 




Chapter 7 deals with how to deal with things that go wrong and in this case OCaml is fairly standard and uses exceptions.  Chapter 8 introduces tuples, which other books tend to introduce eariler - I think they are best left till later.  Chapter 9 expands what we can do with functions using partial evaluation. Chapter 10 is about types and pattern matching based on types as a way of creating polymorphic functions.

Chapter 11 is about strings, Chapter 12 is about I/O, Chapter 13 goes further into type? and Chapter 14 introduces floating point numbers. Most languages need floating point numbers introduced much earlier, but the examples that OCaml is best at mean that you really don't need to know about "the other numbers" until later. Chapter 15 is about using the standard library of OCaml functions and the final chapters is a round up of techniques used in building bigger programs. 

The book is light on object-oriented ideas but given the amount there is to take in this isn't unreasonable and overall more advanced topics are left out for you to study later. In this sense you do need a follow on book if you are going to take OCaml into the real world but this book does prepare you for the next stage of the journey. Another omission is that the book doesn't do much cheer-leading for OCaml. If you don't already know why OCaml is great then you probably won't find out by reading even the introduction to the book. This is a straightforward "get on with it" book on the language. 

If you want to start OCaml really from the very beginning and don't expect such a book to take you all the way to expert, then this is highly recommended.



CSS In Easy Steps 4th Ed

Author: Mike McGrath
Publisher: Easy Steps
Pages: 192
ISBN: 978-1840788754
Print: 1840788755
Kindle: B083ZJD91Z
Audience: CSS beginners
Rating: 5
Reviewed by: David Conrad

If you are looking for a simple beginner's introduction to CSS then this book fits the bill.

The Rust Programming Language, 2nd Ed

Author: Steve Klabnik and Carol Nichols
Publisher: No Starch Press
Date: June 2023
Pages: 560
ISBN: 978-1718503106
Print: 1718503105
Kindle: B0B7QTX8LL
Audience: Systems programmers
Rating: 4.8
Reviewer: Mike James

There's a new edition of what has become the standard text on Rust. Has it matured along with [ ... ]

More Reviews

Last Updated ( Monday, 09 December 2013 )