Match outer forms first - from Kevin's issue #23

This commit is contained in:
Paul deGrandis 2012-03-26 07:45:28 -04:00
parent 4963421cff
commit 9cec3ee154
2 changed files with 2 additions and 1 deletions

View file

@ -42,6 +42,7 @@ Bugs can be reported using the github bug tracker.
* Phil Hagelberg * Phil Hagelberg
* Alan Malloy * Alan Malloy
* Paul deGrandis * Paul deGrandis
* Kevin Lynagh
## TODO ## TODO

View file

@ -34,7 +34,7 @@
;; Simplifies expr according to the rules until no more rules apply. ;; Simplifies expr according to the rules until no more rules apply.
(defn simplify [expr rules] (defn simplify [expr rules]
(->> expr (->> expr
(iterate (partial walk/postwalk #(simplify-one % rules))) (iterate (partial walk/prewalk #(simplify-one % rules)))
(partition 2 1) (partition 2 1)
(drop-while #(apply not= %)) (drop-while #(apply not= %))
(ffirst))) (ffirst)))