 (ns clojee.core)
 
 ; syntax
-;   (let* [a v1 b v2 c v3] form)
-;   (do form1 form2 form3)
-;   (fn* [a b c] form)
-;   (def q form)
-;   (set! x form)
-;   (loop* [x v1 y v2] form_including_recur)
+;   {let* [a v1 b v2 c v3] form}
+;       warning: shadowing outer variable
+;       error: duplicate names
+;       error: in values of bindings, form
+;   {def q form}
+;       error: q already defined
+;   q
+;       error: q not resolvable
+;   (f x y)
+;   {do form1 form2 form3}
+;   {fn* [a b c] form}
+;       error: duplicate names
+;   {set! x form}
+;   {loop* [x v1 y v2] form_including_recur}
 ;       - no recur: warning, suggest let*
 ;       - nested loops: warning, recur may not work as expected
 ;       - duplicate var names: error
-;   (if pred then else)
-;     (if true  a b) -> a
-;     (if false a b) -> b
-
-(defn make-let
-  [bindings body]
-  {:type "let*"
-   :bindings bindings
-   :body body})
+;   {if pred then else}
+;     {if true  a b} -> a
+;     {if false a b} -> b
 
 (defn make-do
   [forms]

  {: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]
