aboutsummaryrefslogtreecommitdiff
path: root/src/clojure
diff options
context:
space:
mode:
authorscgilardi <scgilardi@gmail.com>2008-12-05 03:13:19 +0000
committerscgilardi <scgilardi@gmail.com>2008-12-05 03:13:19 +0000
commitb40dc10950ada9d733ec6d7e4e3dd650ca1f6659 (patch)
treef50dcae3d87190d93198806ac002f8da82af7fae /src/clojure
parent6e81055fa52b1e64e951c34ef9f4b363bd7e0139 (diff)
cond-let: breaking change, updated to the new binding syntax (a vector)
Diffstat (limited to 'src/clojure')
-rw-r--r--src/clojure/contrib/cond.clj15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/clojure/contrib/cond.clj b/src/clojure/contrib/cond.clj
index 220192a5..0e940a60 100644
--- a/src/clojure/contrib/cond.clj
+++ b/src/clojure/contrib/cond.clj
@@ -22,10 +22,11 @@
binding-compatible with binding-form, or use :else as the test and don't
refer to any parts of binding-form in the expr. (cond-let binding-form)
returns nil."
- [binding-form & clauses]
- (when-let [[test expr & more] clauses]
- (if (= test :else)
- expr
- `(if ~test
- (let [~binding-form ~test] ~expr)
- (cond-let ~binding-form ~@more)))))
+ [bindings & clauses]
+ (let [binding (first bindings)]
+ (when-let [[test expr & more] clauses]
+ (if (= test :else)
+ expr
+ `(if-let [~binding ~test]
+ ~expr
+ (cond-let ~bindings ~@more))))))