SICP Practice

Practice 2.77

(define (magnitude z)
  (apply-generic 'magnitude z))

(define z '(complex '(rectangular '(3 4))))

first, apply-generic dispatch magnitude with ‘complex

(magnitude z) will invoke

((get 'magnitude 'complex) (contents z))

equal

((get 'magnitude 'complex) '(rectangular '(3 4)))

then apply-generic will dispatch rectangular.

so apply-generic twice