Choosing a function to apply
> (define (do-command command arglist)
(let (f)
(if (equal? command '(multiply that))
(set! f *) (set! f +) )
(apply f arglist)
)
)
DO-COMMAND
> (do-command '(add them) '(8 13))
21
> (do-command '(multiply that) '(8 13))
104
Previous slide
Next slide
Back to first slide
View graphic version