Open
Description
Hey, great library, thanks for your work!
I'd like to create edit scripts for Clojure code patches. Would it be feasible to add operations for structural editing? I'm thinking mainly about the following ones, tho there are some others.
- wrap:
expr
->(expr)
- raise:
(foo expr bar)
->expr
- slurp:
(foo) expr
->(foo expr)
- barf:
(foo expr)
->(foo) expr
Each could work for vectors and sets as well.
Example:
(e/diff
'(do
(let [a 6])
(+ a 9))
'(do
(let [a 6]
(+ a 10))))
-> [[[1 2] :+ (+ a 10)]
[[2] :-]]
would result in a cheaper sequence of operations:
[[[1] :slurp]
[[1 2 2] :r 10]]
Another example:
(e/diff
'(do
(large-expr))
'(do
(let [a 6]
(large-expr))))
-> [[[1] :r (let [a 6] (large-expr))]]
would become something like
[[[1] :wrap :list]
[[1 0] :+ let]
[[1 1] :+ [a 6]]]