That's an interesting way of getting around it, feels slightly hacky but understandable due to the nature of EDN literals
Going a step further for programmer safety I guess it should be possible to detect when "undefined behavior" like that is happening (same memory var being used in separate branches of a map/set literal, excluding &
) and flag it as an error
the example above might be contrived but I imagine it could happen with a big record-like map pattern and everything appearing to work fine until the 9th key is introduced
sounds good, I'll create a GH issue to track it :)
actually it's still a little confusing - here's a simpler case where memory vars currently fall apart:
(m/rewrite [:a [1 2 3] :b [4 5]]
[!k [!n ...] ...]
[!k [!n ...] ...])
;; => [:a [1 2 3 4 5]]
how would I use the hypothetical &scope
construct to retain the nesting associations and rewrite back to the same data on the RHS?
They don’t fall apart, you just need more of them 🙂
(m/rewrite [:a [1 2 3] :b [4 5]]
[!k [!x ..!n] ..!m]
[!k [!x ..!n] ..!m])
;; => [:a [1 2 3] :b [4 5]]
My plan was to let you be able to just do ..!
without naming them and make it all work out. I had an implementation, but never finished it and got it in.
ahh, more undocumented syntax 😮
I’m shocked that didn’t get documented. My bad. I will start writing the documentation right this moment.
And I will throw in some & documentation.
Thanks!
Not comprehensive, but hopefully it is a start. https://github.com/noprompt/meander/pull/98
I do apologize of the lack of documentation on things like this. I need to sit down and write a comprehensive tutorial. But there is honestly just a lot. It is hard to remember what got documented and what didn’t. It is also just hard to document. It is more like learning a language than learning a library. Libraries are typically not too hard to document, but libraries require a different approach. I also need to finish my in browser meander evaluator so we can have an interactive cookbook that anyone can contribute to.
I apologize as well. I’m almost always busy with work, family, or something due to this project and documentation frequently slips my mind or doesn’t get priority.
I will also admit that it often takes me a bit of time to write articles because I have to focus really hard to organize my thoughts into words.
I really appreciate all the lively, thoughtful discussion from everyone. 🙂
Thank you!