summaryrefslogtreecommitdiff
path: root/community-garden.scm
diff options
context:
space:
mode:
Diffstat (limited to 'community-garden.scm')
-rw-r--r--community-garden.scm46
1 files changed, 27 insertions, 19 deletions
diff --git a/community-garden.scm b/community-garden.scm
index 5c8c383..7cd535a 100644
--- a/community-garden.scm
+++ b/community-garden.scm
@@ -40,35 +40,43 @@
"Spritely Institute Community Garden"
(make-garden-bed 8 8)
the-garden-gate)))
+(define our-garden-community
+ (garden-run
+ (spawn ^garden-community our-garden)))
(define onion-netlayer (garden-run (new-onion-netlayer)))
(define mycapn
(garden-run
(let* ((mycapn (spawn-mycapn onion-netlayer))
- (garden-sref ($ mycapn 'register our-garden 'onion)))
- (format #t "edit-garden Dave ~a\n" (ocapn-id->string garden-sref))
+ (community-sref ($ mycapn 'register our-garden-community 'onion)))
+ (format #t "Connect to: ~a\n" (ocapn-id->string community-sref))
mycapn)))
-(define alice (alice-run (spawn ^gardener "Alice" our-garden)))
-(alice-run ($ alice 'plant 1 1 sunflower/approved))
-(alice-run ($ alice 'plant 2 1 sunflower/approved))
-(alice-run ($ alice 'plant 1 2 sunflower/approved))
-(alice-run ($ alice 'plant 2 2 sunflower/approved))
-(alice-run ($ alice 'plant 5 1 cabbage/approved))
-(alice-run ($ alice 'plant 6 1 cabbage/approved))
-(alice-run ($ alice 'plant 5 2 cabbage/approved))
-(alice-run ($ alice 'plant 6 2 cabbage/approved))
+(define alice
+ (alice-run (<- our-garden-community 'register-gardener "Alice")))
+(define (alice-plant x y plant)
+ (alice-run (on alice
+ (lambda (alice)
+ (<- alice 'plant x y plant)))))
+
+(alice-plant 1 1 sunflower/approved)
+(alice-plant 2 1 sunflower/approved)
+(alice-plant 1 2 sunflower/approved)
+(alice-plant 2 2 sunflower/approved)
+(alice-plant 5 1 cabbage/approved)
+(alice-plant 6 1 cabbage/approved)
+(alice-plant 5 2 cabbage/approved)
+(alice-plant 6 2 cabbage/approved)
-(define catbird-visitor (catbird-run (spawn ^visitor "Catbird UI" our-garden)))
+(define catbird-visitor
+ (catbird-run (<- our-garden-community 'register-visitor "Catbird Viewer")))
(define catbird-garden-bed (make-atomic-box #f))
(define catbird-garden-name (make-atomic-box #f))
(catbird-run
- (on ($ catbird-visitor 'get-garden-name)
- (lambda (name)
- (atomic-box-set! catbird-garden-name name))))
-(catbird-run
- (on ($ catbird-visitor 'inspect-garden)
- (lambda (garden-bed)
- (atomic-box-set! catbird-garden-bed garden-bed))))
+ (on catbird-visitor
+ (lambda (visitor)
+ (on (<- visitor 'get-garden-name)
+ (lambda (name)
+ (atomic-box-set! catbird-garden-name name))))))
(run-catbird
(lambda ()