Created
September 1, 2010 14:38
-
-
Save Chouser/560765 to your computer and use it in GitHub Desktop.
This file contains 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
;; 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)) |
This file contains 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
;; 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