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 c7f8ee9..50ac1e8 100644
--- a/chickadee/graphics/seagull.scm
+++ b/chickadee/graphics/seagull.scm
@@ -215,6 +215,20 @@
(define params* (lookup-all params env*))
`(lambda ,params* ,(expand body env*)))
+(define (expand:+ args env)
+ (match args
+ (() 0)
+ ((n) (expand n env))
+ ((n . rest)
+ `(primcall + ,(expand n env) ,(expand:+ rest env)))))
+
+(define (expand:* args env)
+ (match args
+ (() 1)
+ ((n) (expand n env))
+ ((n . rest)
+ `(primcall * ,(expand n env) ,(expand:* rest env)))))
+
(define (expand:primitive-call operator operands env)
`(primcall ,operator ,@(expand:list operands env)))
@@ -248,6 +262,10 @@
;; Macros:
(('let* (bindings ...) body)
(expand:let* bindings body env))
+ (('+ args ...)
+ (expand:+ args env))
+ (('* args ...)
+ (expand:* args env))
;; Primitive calls:
(((? primitive-call? operator) args ...)
(expand:primitive-call operator args env))