;1. "let" usage in one form: => (let [x 1 y (+ x 2)] (println (+ x y)) (println (- x y))) 4 -2 nil
;2. "if" usage in some forms: ; 1. Only "false" and "nil" is "false", anything else in clojure is "true"; ; 2. The value of the selected sub expression is the value of the "if" form. (if (notnil) truefalse) true user=> (if0truefalse) true user=> (if-1truefalse) true user=> (ifniltruefalse) false
;3. The difference between "let" and "binding": ; 1. For "binding", the binding can be used in the form who created ; the "binding" and can also be used in the functions inside the ; form; for "let", the binding cannot be used outside "let" while ; inside the "form" who created the "let", cannot be used in the ; functions inside the form who created the "let" either. ; 2. "binding" can only be used on "dynamic var". user=> (let [x 1 y (+ x 1)] (- x y)) -1 user=> (binding [x 1 y (+ x 1)] (- x y)) CompilerException java.lang.RuntimeException: Unable to resolve var: x in this context, compiling:(NO_SOURCE_PATH:1:1) user=> (def ^:dynamicx1) #'user/x user=> (def ^:dynamicy (+11)) #'user/y user=> (binding [x 1 y (+ x 1)] (- x y)) -1