     :else (throw (new Exception (str "unrecognized node -- " (if (nil? node) "nil" node))))))
 
 (defn f-node
-  [node log env]
-  (do (prn (str "checking ..." node " in " env)))
+  [node log env state]
+;  (do (prn (str "checking ..." node " in " env)))
   (let [type (my-type node)]
     (if (contains? actions type)
-        ((actions type) node log env)
+        ((actions type) node log env state)
         (throw (new Exception (str "unrecognized node type -- " node))))))
 
 
-(def root-env (new-env #{'z} {:depth 0}))
+(def root-env (new-env #{} {:depth 0}))
+(def root-state {:bindings '#{True False}})
 
 (defn run-eg
   ([] (run-eg (second eg1)))
-  ([node] (run-eg node '() root-env))
-  ([node log env] 
-   (doseq [x (f-node node log env)]
-     (prn x))))
-
+  ([node] (run-eg node '() root-env root-state))
+  ([log env state]
+    (m-seq eg1 log env state))
+  ([node log env state]
+    (f-node node log env state)))
+
+(defn prn-eg
+  [& args]
+   (let [[l s] (apply run-eg args)]
+     (doseq [x l]
+       (prn x))
+     (prn s)))
+

  {:type "fn*"
   :params symbols
   :body body})

(defn make-def
  [symbol value]
  {:type "def"
   :symbol symbol
   :value value})

(defn make-set!
  [symbol value]



(def eg1
  [;(make-def 'id (make-fn '(x) 'x))
;   (make-def 'a 'True)
;   (make-def 'b 'False)
;   (make-def 'z (make-app 'a '[a b c]))
   (make-def 'f 'True)
   (make-app 'f '[x y])
   (make-let '[[f g]] (make-let '[[f h]] 'q))
;   (make-let '[[f g] [f h]] 'f)
;   (make-let '[[f g] [x z]] (make-app 'f '[x y]))])
;   (make-def '. (make-fn '(f g x) '(f (g x))))
;   (make-def 'd (make-fn '(x) '(x x)))
;   (make-def 't (make-fn '(f x) '(. f f x)))])
  ])


(defn my-resolve
  [sym env state]
  (cond 
    (nil? env)
      (if (contains? (state :bindings) sym)
          "root state")
    (contains? (env :bindings) sym) (env :depth)
    :else (recur sym (env :parent) state)))

(defn new-env
  [bindings old-env]
