kibit
kibit copied to clipboard
Recursive rules
I was just wondering, is it possible to get kibit to do recursive rules? What I am thinking is something like this
(:c (:b (:a {:a {:b {:c 1}}})))
=> (get-in {:a {:b {:c 1}}} [:a :b :c])
This would require a recursive lookup to see if it makes sense to do the translation.
There probably are other rules, but this is the first one I could think of.
@ljos can you describe what you mean by a recursive rule? If I understand correctly, you're suggesting that multiple keyword lookups could be identified and replaced with a get-in
?
Oh, wow. It is more than 2 years since I posted this. It seems like that is what I meant when I wrote it. Though, I am also talking about /other/ rules... I am not sure, but I might also be thinking about something like
(+ 1 ( + 2 (+ 3 4)))
=> (+ 1 2 3 4)
and in cases like this where the operation is commutable and it is possible to flatten the tree structure.