       )))
 
 (defn- optimize-add [e]
-  (cond
-    (add? e) (optimize-op e + 0)
-    :else e))
+  (if (add? e)
+    (optimize-op e + 0)
+    e))
 
 (defn- optimize-mul [e]
-  (cond
-    (mul? e) (if (some #{0} e) (cst 0) (optimize-op e * 1))
-    :else e))
+  (if (mul? e)
+    (if (some #{0} e)
+      (cst 0)
+      (optimize-op e * 1))
+    e))
 
-(defn optimize
-  [e]
-  (walk/postwalk
-    (comp optimize-mul optimize-add)
-    e))
+(defn optimize [e]
+  (walk/postwalk (comp optimize-mul optimize-add) e))
 
 
 ;; ----------------------------------------------------------------------------

(defn add [& args] (into [:add] args))
(defn mul [& args] (into [:mul] args))

(defn cst? [n] (number? n))
(defn sym? [v] (string? v))
(defn op? [e] (vector? e))
(defn add? [e] (and (op? e) (= (first e) :add)))
(defn mul? [e] (and (op? e) (= (first e) :mul)))

(defn rands [e] (rest e))


;; ----------------------------------------------------------------------------

  (if (string? x) (get env x x) x))

(defn partial-eval
  [env e]
  (walk/postwalk
    (comp optimize-mul optimize-add #(replace-var env %))
    e))

;; ----------------------------------------------------------------------------

