summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2008-04-28 14:33:30 +0000
committerRich Hickey <richhickey@gmail.com>2008-04-28 14:33:30 +0000
commitef740c3734a3deb2b3de70340648e5b7dfb8488c (patch)
tree5064f4ba5587c492e7f0468b49e308f111b237c1
parentc6f92c0dec0938fbb5df28247dd69666d4c5e287 (diff)
made else form optional in if-let
-rw-r--r--src/boot.clj14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/boot.clj b/src/boot.clj
index 66ae81e0..c023c3a0 100644
--- a/src/boot.clj
+++ b/src/boot.clj
@@ -2291,12 +2291,14 @@ not-every? (comp not every?))
(defmacro if-let
"if test is true, evaluates then with binding-form bound to the value of test, if not, yields else"
- [binding-form test then else]
- `(let [temp# ~test]
- (if temp#
- (let [~binding-form temp#]
- ~then)
- ~else)))
+ ([binding-form test then]
+ `(if-let ~binding-form ~test ~then nil))
+ ([binding-form test then else]
+ `(let [temp# ~test]
+ (if temp#
+ (let [~binding-form temp#]
+ ~then)
+ ~else))))
(defmacro when-let
"when test is true, evaluates body with binding-form bound to the value of test"