about summary refs log tree commit diff stats
path: root/js/games/nluqo.github.io/~bh/61a-pages/Lectures/3.0/demo.scm
blob: d78ae82dac47ac6d4e9c5967799860e681a068c9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
(define-class (complex real-part imag-part)
  (method (magnitude)
    (sqrt (+ (* real-part real-part)
	     (* imag-part imag-part))))
  (method (angle)
    (atan (/ imag-part real-part))) )

(define-class (counter)
  (instance-vars (count 0))
  (method (next)
    (set! count (+ count 1))
    count) )

(define-class (doubler)
  (method (say stuff) (se stuff stuff)))