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 ...

Get Clojure Applied now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.