diff src/rlm/abomination_desolation.clj @ 0:78a630e650d2

initial import
author Robert McIntyre <rlm@mit.edu>
date Tue, 18 Oct 2011 00:57:08 -0700
parents
children
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/rlm/abomination_desolation.clj	Tue Oct 18 00:57:08 2011 -0700
     1.3 @@ -0,0 +1,23 @@
     1.4 +(ns abomination-desolation)
     1.5 +
     1.6 +;; The Abomination:
     1.7 +
     1.8 +(defmacro dolet [& [_ eq :as s]]
     1.9 +  (if (and eq (= "=" (name eq)))
    1.10 +    (let [[lcl _ expr & more] s]
    1.11 +      `(let [~lcl ~expr]
    1.12 +	 (dolet ~@more)))
    1.13 +    (let [[expr & more] s]
    1.14 +      (if (empty? more)
    1.15 +	expr
    1.16 +	`(do ~expr (dolet ~@more))))))
    1.17 +
    1.18 +;; The Desolation:
    1.19 +
    1.20 +(defn doit []
    1.21 +  (dolet
    1.22 +   i = 5
    1.23 +   j = 10
    1.24 +   (println i j)
    1.25 +   k = (+ i j)
    1.26 +   (* k 2)))