12 lines
262 B
Scheme
12 lines
262 B
Scheme
|
(define (get-method object message)
|
||
|
(object message))
|
||
|
|
||
|
(define method? procedure?)
|
||
|
|
||
|
(define (send object message . args)
|
||
|
(let ((method (get-method object message)))
|
||
|
(if (method? method)
|
||
|
(apply method (cons object args))
|
||
|
(error "No method" message))))
|
||
|
|