*@*Thomas Heller: It's a bit cleaner indeed. That way, a 'join-like'
operation does not need to know about the structure. But the three
problematics from my post are still unsolved.
*@Francois Rey:* I believe walk/prewalk/postwalk (and zipper?) might be the
building blocks for implementing query/update based on a more flexible path
definition. But by themselves, they are a bit low level. They indeed are
beautiful and useful abstractions but I think another abstraction, even
higher, could be built.
*@Daniel Neal:* I will look into it. I am new to lenses as I said. I don't
know if a lens can target multiple structures at once (first question).
(def s { :key1 [{ :key2 { :key3 val } }]})
(update-in s [:key1 :all :key2 :key3] inc)
The principle might work with a custom lens but I guess it is likely the
implementation for the traversal must be changed in order to handle a
sequence at each step. But at least I have a place where I can start from.
Bertrand
Le jeudi 10 juillet 2014 13:26:57 UTC+2, Daniel Neal a écrit :
>
> > Is there a way to do something similar with a more general definition of
> a path?
>
> The lens library Fresnel (https://github.com/ckirkendall/fresnel) might
> be worth a look - it abstracts
> get-in/assoc-in into lenses which can store/retrieve state from complex
> structures (and can be composed).
>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.