racket/collects/htdp/draw.ss
Matthias Felleisen fb644c1caf relevant teachpacks converted
svn: r9470
2008-04-25 00:50:03 +00:00

25 lines
798 B
Scheme

#lang scheme
(require htdp/big-draw
htdp/draw-sig
mzlib/unit)
(define-syntax (draw s)
(syntax-case s (produce)
[(_ stmt ... produce exp) (syntax (begin (and stmt ...) exp))]
[(_ stmt ... produce)
(raise-syntax-error #f "produce must be followed by an expression" s)]
[(_ stmt ... produce exp exp2)
(raise-syntax-error #f "produce must be followed by exactly one expression" s)]
[(_ stmt ... produce exp exp2 exp3)
(raise-syntax-error #f "produce must be followed by exactly one expression" s)]
[(_ stmt ...)
(raise-syntax-error #f "use drawing instructions between _draw_ and _produce_ and an expression behind produce" s)]
))
(provide
draw ;; (draw <expression> ... produce <expression>)
)
(provide-signature-elements draw^)