Skip to content

Instantly share code, notes, and snippets.

@MShrimp4
Created November 3, 2018 00:34
Show Gist options
  • Save MShrimp4/afd0d49e6cacaccb57da35929e11f064 to your computer and use it in GitHub Desktop.
Save MShrimp4/afd0d49e6cacaccb57da35929e11f064 to your computer and use it in GitHub Desktop.
Automatic Let -Clojure macro
(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