summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/graphics/seagull.scm18
1 files changed, 18 insertions, 0 deletions
diff --git a/chickadee/graphics/seagull.scm b/chickadee/graphics/seagull.scm
index 6af69eb..b3aef24 100644
--- a/chickadee/graphics/seagull.scm
+++ b/chickadee/graphics/seagull.scm
@@ -301,6 +301,20 @@
((l . rest)
(loop rest `(primcall / ,exp ,(expand l stage env)))))))))
+(define (expand:or exps stage env)
+ (match exps
+ (() #f)
+ ((exp . rest)
+ (expand `(let ((x ,exp)) (if x x (or ,@rest)))
+ stage env))))
+
+(define (expand:and exps stage env)
+ (match exps
+ (() #t)
+ ((exp . rest)
+ (expand `(let ((x ,exp)) (if x (and ,@rest) #f))
+ stage env))))
+
(define (expand:primitive-call operator operands stage env)
`(primcall ,operator ,@(expand:list operands stage env)))
@@ -368,6 +382,10 @@
(expand:* args stage env))
(('/ args ...)
(expand:/ args stage env))
+ (('or exps ...)
+ (expand:or exps stage env))
+ (('and exps ...)
+ (expand:and exps stage env))
;; Primitive calls:
(((? primitive-call-for-stage? operator) args ...)
(expand:primitive-call operator args stage env))