Skip to content
Browse files

Make OR? and AND? short-circuiting, dude.

  • Loading branch information...
1 parent d26e033 commit dca031cf44f032febbbebe5dbe31aeb7ad2a51da @manuel committed Mar 20, 2012
Showing with 13 additions and 1 deletion.
  1. +13 −1 standard.virtua
View
14 standard.virtua
@@ -66,7 +66,19 @@
(make-environment)
(car opt))))
-(defun or? (a b) (if a #t (if b #t #f)))
+(defmacro or? (a b) env
+ (if (eval a env)
+ #t
+ (if (eval b env)
+ #t
+ #f)))
+
+(defmacro and? (a b) env
+ (if (eval a env)
+ (if (eval b env)
+ #t
+ #f)
+ #f))
(defun map (fn list)
(if (null? list)

0 comments on commit dca031c

Please sign in to comment.
Something went wrong with that request. Please try again.