Lenses are an important concept in functional programming with great
practical utility. Several years ago, we already introduced functional
lenses
here on the blog. Since then, we have continuously expanded our use of lenses in
our daily work. Today we want to show how we
use lenses as bidirectional transformations and how they help us
convert between data representations.
We implement the example for this article with our comprehensive and
freely available Clojure library called Active
Clojure, which we use in all
our Clojure projects. This library includes
implementations of lenses and
Records,
the latter of which is for representing compound data in Clojure. The
combination of lenses and records is particularly helpful.
Read on...