diff options
Diffstat (limited to 'js/games/nluqo.github.io/~bh/61a-pages/Lectures/3.0/demo.scm')
-rw-r--r-- | js/games/nluqo.github.io/~bh/61a-pages/Lectures/3.0/demo.scm | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/js/games/nluqo.github.io/~bh/61a-pages/Lectures/3.0/demo.scm b/js/games/nluqo.github.io/~bh/61a-pages/Lectures/3.0/demo.scm new file mode 100644 index 0000000..d78ae82 --- /dev/null +++ b/js/games/nluqo.github.io/~bh/61a-pages/Lectures/3.0/demo.scm @@ -0,0 +1,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))) |