WIP: adding in the simplify stuff back into the new logic stuff

This commit is contained in:
Paul deGrandis 2012-03-19 16:12:19 -04:00
parent 21a0d9dcf7
commit e738d100c6

View file

@ -17,17 +17,25 @@
(guard expr))
(check-guards expr rest)))
(defn simplify
[expr rules]
(first (run* [q]
(fresh [pat guards alt]
(membero [pat guards alt] rules)
(== pat expr)
(check-guards expr guards)
(== q {:expr expr
:alt alt
:line (-> expr meta :line)})))))
(defn simplify-one
([expr]
(simplify-one expr all-rules))
([expr rules]
(first (run* [q]
(fresh [pat guards alt]
(membero [pat guards alt] rules)
(== pat expr)
(check-guards expr guards)
(== q {:expr expr
:alt alt
:line (-> expr meta :line)}))))))
(declare expr-seq)
(defn simplify
([expr]
(simplify expr all-rules))
([expr rules]
(walk/postwalk identity (expr-seq expr))))
;; Reading source files
;; --------------------