diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/clojure/contrib/cond.clj | 15 |
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)))))) |