3 ms·
What a coincidence. I've been working on a macro to do exactly this yesterday and think I might have a working version tonight or tomorrow. In Clojure too. The
by GorgeRonde 7y ago
What a coincidence. I've been working on a macro to do exactly this yesterday and think I might have a working version tonight or tomorrow. In Clojure too.
The only difference is in the way I decided to treat arrays
(xxx {:a [1 2 3]}
{:a [_ _ inc]})
;; {:a [1 2 4]}
This is because I intend to use it on arg vectors rather than proper data. So I'm fine with having to access everything step by step from the left and having a one to one relation between leafs in the data tree and leafs in the transformer tree. Actually I wrote a cowalk function (as well as coprewalk, copostwalk, etc), to allow for traversal and editing of multiple data structures at the same time provided they have the same shape.
- valw 7y agoInteresting! In supdate the transform would be: {:a {2 inc}}