Last active
May 30, 2018 14:31
-
-
Save alex-dixon/4dee1b6a81fa7c86d010aabfddefe17a to your computer and use it in GitHub Desktop.
Revisions
-
alex-dixon revised this gist
May 30, 2018 . 1 changed file with 0 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,17 +1,3 @@ (defmacro deflet [bindings & body] `(do ~@(for [[sym expr] (partition 2 (destructure bindings))] (list 'def sym expr)) -
alex-dixon revised this gist
Apr 28, 2018 . 1 changed file with 12 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,8 +17,20 @@ (list 'def sym expr)) ~@body)) (defmacro defbindings [bindings] `(do ~@(for [[sym expr] (partition 2 (destructure bindings))] (list 'def sym expr)))) (defmacro deflast [sym] `(def ~sym *1)) ;(deflet [foo 1 ; [_ bar] [1 2] ; {:keys [baz]} {:baz 3}] ; (+ foo bar baz)) ;=> 6 ;(+ 1 1) ;(deflast foo) ;foo => 2 -
alex-dixon revised this gist
Apr 27, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,5 +20,5 @@ ;(deflet [foo 1 ; [_ bar] [1 2] ; {:keys [baz]} {:baz 3}] ; (+ foo bar baz)) ;=> 6 -
alex-dixon revised this gist
Apr 27, 2018 . 1 changed file with 12 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,4 +10,15 @@ " [& bindings] `(do ~@(for [[sym expr] (partition 2 (destructure bindings))] (list 'def sym expr)))) (defmacro deflet [bindings & body] `(do ~@(for [[sym expr] (partition 2 (destructure bindings))] (list 'def sym expr)) ~@body)) ;(deflet [foo 1 ; [_ bar] [1 2] ; {:keys [baz]} {:baz 3}] ; (+ foo bar baz)) ;=> 6 -
alex-dixon created this gist
Apr 18, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ (defmacro | "Takes a variable even number binding to expression pairs and defs each in the current namespace. (defn my-func [args] (let [(| foo :bar {:keys [a b]} {:a 1 :b 2} c (+ a b) d c)])) d => 3 " [& bindings] `(do ~@(for [[sym expr] (partition 2 (destructure bindings))] (list 'def sym expr))))