dhh1128 / intent

the intent formal language
https://intentlang.org
2 stars 1 forks source link

consider adding some language sugar to navigate and transform data structures #119

Open dhh1128 opened 8 years ago

dhh1128 commented 8 years ago

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