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

Mapping Values

As data moves around your application it’s common for one part of the application to need it in a different form. One subsystem imports data from a spreadsheet with 30 columns into a generic map with 30 keys. Another subsystem needs just 5 columns but in the form of an entity, and yet another system needs only a single field from a sequence of entities to perform a calculation or display it on the screen.

All of these use cases require transformation of the values in a sequential source from one form to another. In Clojure, the map function is used to apply a function to every element in a sequence and produce a new sequence of the results.

For example, consider the need to extract the orbital periods for every planet entity in ...

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