projects
/
8sync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add comment noting that the "web" system needs a rewrite.
[8sync.git]
/
demos
/
actors
/
botherbotherbother.scm
diff --git
a/demos/actors/botherbotherbother.scm
b/demos/actors/botherbotherbother.scm
old mode 100644
(file)
new mode 100755
(executable)
index
3a2747a
..
8daed93
--- a/
demos/actors/botherbotherbother.scm
+++ b/
demos/actors/botherbotherbother.scm
@@
-1,3
+1,7
@@
+#!/usr/bin/guile \
+-e main -s
+!#
+
;;; 8sync --- Asynchronous programming for Guile
;;; Copyright (C) 2016 Christopher Allan Webber <cwebber@dustycloud.org>
;;;
;;; 8sync --- Asynchronous programming for Guile
;;; Copyright (C) 2016 Christopher Allan Webber <cwebber@dustycloud.org>
;;;
@@
-77,6
+81,7
@@
;; Oof! Those kids!
(display (string-append (random-choice complaints)))
;; Oof! Those kids!
(display (string-append (random-choice complaints)))
+ (newline)
;; More than one student is bothering us, lose our temper
(if (> (hash-count (const #t) whos-bothering)
;; More than one student is bothering us, lose our temper
(if (> (hash-count (const #t) whos-bothering)
@@
-108,23
+113,24
@@
(define num-students 10)
(define num-students 10)
-(define (main)
+(define (main
. args
)
(define agenda (make-agenda))
(define hive (make-hive))
(define agenda (make-agenda))
(define hive (make-hive))
- (define professor (hive-create-actor
hive <professor>
))
+ (define professor (hive-create-actor
* hive <professor> "prof"
))
(define namegen (student-name-generator))
(define students
(map
(lambda _
(define namegen (student-name-generator))
(define students
(map
(lambda _
- (hive-create-actor* hive <student>
- (#:name (namegen))))
+ (let ((name (namegen)))
+ (hive-create-actor* hive <student> name
+ #:name name)))
(iota num-students)))
;; Bootstrap each student into bothering-professor mode.
(define start-bothering-tasks
(map
(lambda (student)
(iota num-students)))
;; Bootstrap each student into bothering-professor mode.
(define start-bothering-tasks
(map
(lambda (student)
- (
hive-
bootstrap-message hive student 'bother-professor
+ (bootstrap-message hive student 'bother-professor
#:target professor))
students))
#:target professor))
students))