Lots of code needs to walk data structures and do a transformation on them.
Python has the "map" function that applies a transform to every element in a collection.
The Spectre library in Clojure builds on a similar concept, but it allows you to define a "path" through one or more layers of data structure to identify an element, and then provide a transforming function to operate on that path. You can pass in different paths to the same general algorithm, making it possible to walk a binary tree, a list, a map, and other structures and do the same thing on end nodes, varying only the path through the data structures.
Lots of code needs to walk data structures and do a transformation on them.
Python has the "map" function that applies a transform to every element in a collection.
The Spectre library in Clojure builds on a similar concept, but it allows you to define a "path" through one or more layers of data structure to identify an element, and then provide a transforming function to operate on that path. You can pass in different paths to the same general algorithm, making it possible to walk a binary tree, a list, a map, and other structures and do the same thing on end nodes, varying only the path through the data structures.
See http://nathanmarz.com/blog/functional-navigational-programming-in-clojurescript-with-sp.html