Created
November 3, 2018 00:34
-
-
Save MShrimp4/afd0d49e6cacaccb57da35929e11f064 to your computer and use it in GitHub Desktop.
Automatic Let -Clojure macro
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 characters
(defn _autolet [exp] | |
(cond | |
(empty? exp) exp | |
(= (ffirst exp) :=) (let [app (into (vector) (rest (first exp))) | |
rexp (_autolet (rest exp))] | |
`((let ~app ~@rexp))) | |
:else (cons (first exp) (_autolet (rest exp))))) | |
(defmacro autolet [& exp] | |
`(do ~@(_autolet exp))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment