kibit icon indicating copy to clipboard operation
kibit copied to clipboard

Recursive rules

Open ljos opened this issue 12 years ago • 2 comments

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 avatar Oct 17 '12 20:10 ljos

@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?

danielcompton avatar Nov 09 '14 19:11 danielcompton

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.

ljos avatar Nov 09 '14 21:11 ljos