OSDN Git Service

[UPDATE] Class sample
authormzp <mzpppp@gmail.com>
Sat, 1 Nov 2008 03:35:46 +0000 (12:35 +0900)
committermzp <mzpppp@gmail.com>
Sat, 1 Nov 2008 03:35:46 +0000 (12:35 +0900)
example/class.scm

index cff377c..5120583 100644 (file)
@@ -1,13 +1,18 @@
 ;; Example for class definition
+;;; 42
 ;;; 12
 ;;; [object Foo]
 ;;; 10
 
-(define-class Foo Object
-  ([init x] (let ((t 10)) 
-             (let ((t 12))
-               (print t))))
-  ([f    x] (print x)))
+(define-class Foo (Object) ())
+(define-method init ((self Foo) x)
+  (print x)
+  (let ((t 10)) 
+    (let ((t 12))
+      (print t))))
+
+(define-method f ((self Foo) x)
+  (print x))
 
 (define foo (new Foo 42))
 (print foo)