O'Reilly logo

Clojure Applied by Alex Miller, Ben Vandgrift

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Constructing Entities

Once you’ve defined an entity’s structure, you need to build functions that populate that structure. Most of the time, you populate your entities using defrecord’s positional and map factory functions, or the core library functions to create maps (like {}, hash-map, and zipmap).

However, some common situations deserve a bit more consideration. One of the most common situations is the case of entities with optional values. Clojure can deal with this in a number of ways, and we’ll look at some of the most common. We’ll also look at constructors that create derived values or have side effects.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required