6 ms·
>subtyping in a more general way This is correct. I read her paper closely. One example I give is how SICP provides two implementations for complex numbers[1],
by cratermoon 2y ago
>subtyping in a more general way
This is correct. I read her paper closely. One example I give is how SICP provides two implementations for complex numbers[1], the rectangular for and polar form.
(make-rectangular (real-part z) (imag-part z))
and
(make-polar (magnitude z) (angle z))
then on page 138 provides this interface that both satisfy
(define (real-part obj) (operate 'real-part obj))
(define (imag-part obj) (operate 'imag-part obj))
(define (magnitude obj) (operate 'magnitude obj))
(define (angle obj) (operate 'angle obj))
1 https://mitp-content-server.mit.edu/books/content/sectbyfn/books_pres_0/6515/sicp.zip/full-text/book/book-Z-H-17.html#%_sec_2.4.1 https://mitp-content-server.mit.edu/books/content/sectbyfn/b...