Skip to Main Content
Hands-On Reactive Programming with Clojure - Second Edition
book

Hands-On Reactive Programming with Clojure - Second Edition

by Konrad Szydlo, Leonardo Borges
January 2019
Intermediate to advanced content levelIntermediate to advanced
298 pages
7h 46m
English
Packt Publishing
Content preview from Hands-On Reactive Programming with Clojure - Second Edition

The option functor

As Tony Hoare once put it, null references were his one billion dollar mistake[3]. Regardless of your background, you will no doubt have encountered versions of the dreadful NullPointerException. This usually happens when we try to call a method on an object reference that is null.

Clojure deals with null values due to its interoperability with Java. In this section we will learn how Clojure provides improved support for dealing with null values.

The core library is packed with functions that do the right thing if passed a nil value (Clojure's version of Java's null). For instance, how many elements are there in a nil sequence? Consider the following code snippet:

(count nil) ;; 0 

Thanks to conscientious design decisions ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Clojure Programming

Clojure Programming

Chas Emerick, Brian Carper, Christophe Grand
Clojure in Action, Second Edition

Clojure in Action, Second Edition

Amit Rathore, Francis Avila
Programming Clojure, 2nd Edition

Programming Clojure, 2nd Edition

Stuart Halloway, Aaron Bedra

Publisher Resources

ISBN: 9781789346138Supplemental Content