Skip to content

Instantly share code, notes, and snippets.

@Chouser
Created September 1, 2010 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Chouser/560765 to your computer and use it in GitHub Desktop.
Save Chouser/560765 to your computer and use it in GitHub Desktop.
;; The Alternate Abomination:
(defmacro dolet [[x1 lcl expr :as x] & more]
(if (= x1 'let)
`(let [~lcl ~expr]
(dolet ~@more))
(if (empty? more)
x
`(do ~x (dolet ~@more)))))
;; The Desolation:
(dolet
(let i 5)
(let j 10)
(prn i j)
(let k (+ i j))
(* k 2))
;; The Abomination:
(defmacro dolet [& [_ eq :as s]]
(if (and eq (= "=" (name eq)))
(let [[lcl _ expr & more] s]
`(let [~lcl ~expr]
(dolet ~@more)))
(let [[expr & more] s]
(if (empty? more)
expr
`(do ~expr (dolet ~@more))))))
;; The Desolation:
(dolet
i = 5
j = 10
(prn i j)
k = (+ i j)
(* k 2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment