From b40dc10950ada9d733ec6d7e4e3dd650ca1f6659 Mon Sep 17 00:00:00 2001 From: scgilardi Date: Fri, 5 Dec 2008 03:13:19 +0000 Subject: cond-let: breaking change, updated to the new binding syntax (a vector) --- src/clojure/contrib/cond.clj | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/clojure') 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)))))) -- cgit v1.2.3-70-g09d2