Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #lang racket
- (require syntax/parse/define
- plot)
- (provide (except-out (all-from-out racket)
- #%module-begin)
- (rename-out [lesson1:#%module-begin #%module-begin]))
- (module reader syntax/module-reader lesson1)
- (define (plot-it functions names)
- (define (make-surface function name color)
- (surface3d function -1 1 -1 1 #:label name #:color color #:line-color color))
- (define surfaces
- (for/list ([color (in-naturals)]
- [function (in-list functions)]
- [name (in-list names)])
- (make-surface function name color)))
- (plot3d surfaces))
- (define-syntax (lesson1:#%module-begin stx)
- (syntax-parse stx
- [(_ (~describe "function definition of two variables that returns a real number"
- ((~literal define) (name:id x-argument:id y-argument:id)
- body:expr ...+)) ...+)
- #'(#%module-begin
- (define/contract (name x-argument y-argument)
- (-> real? real? real?)
- body ...)
- ...
- (plot-it (list name ...)
- (list (symbol->string 'name) ...)))]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement