(import srfi-69 matchable)
-(define trace-enabled #t)
+(define trace-enabled #f)
;;;
;;; Actor creation
--- /dev/null
+(load "actors.scm")
+
+(define trace-enabled #t)
+
+(define factorial
+ (make-actor-with-address
+ 'factorial
+ (lambda (self customer n)
+ (if (= n 0)
+ (send-message customer 1)
+ (let ((fact-acc (make-actor
+ (lambda (self m)
+ (send-message customer (* n m))
+ 'done))))
+ (send-message self fact-acc (- n 1))
+ 'sleep)))))
+
+(define println
+ (make-actor-with-address 'println
+ (lambda (self . message)
+ (apply print message)
+ 'sleep)))
+
+(send-message factorial println 5)
+(run)