X-Git-Url: https://jxself.org/git/?p=8sync.git;a=blobdiff_plain;f=demos%2Factors%2Fsimplest-possible.scm;fp=demos%2Factors%2Fsimplest-possible.scm;h=1cd00ea7a47b87fafead5efda7a4917179bf4a86;hp=0000000000000000000000000000000000000000;hb=3c40164d37f2a11e9439261625c9dd4385a27350;hpb=70b92d795a14d1328b90dd06f8c618b2ea09332d diff --git a/demos/actors/simplest-possible.scm b/demos/actors/simplest-possible.scm new file mode 100644 index 0000000..1cd00ea --- /dev/null +++ b/demos/actors/simplest-possible.scm @@ -0,0 +1,41 @@ +;;; 8sync --- Asynchronous programming for Guile +;;; Copyright (C) 2016 Christopher Allan Webber +;;; +;;; This file is part of 8sync. +;;; +;;; 8sync is free software: you can redistribute it and/or modify it +;;; under the terms of the GNU Lesser General Public License as +;;; published by the Free Software Foundation, either version 3 of the +;;; License, or (at your option) any later version. +;;; +;;; 8sync is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU Lesser General Public License for more details. +;;; +;;; You should have received a copy of the GNU Lesser General Public +;;; License along with 8sync. If not, see . + +(use-modules (8sync systems actors) + (ice-9 match) + (oop goops)) + +(define-simple-actor + ((greet-proog + (lambda (actor message) + (display "Heya Proog!\n") + (send-message + actor (message-ref message 'target) + 'greet-emo))))) + +(define-simple-actor + ((greet-emo + (lambda (actor message) + (display "Hi, Emo!\n"))))) + +(define hive (make-hive)) +(define our-emo (hive-create-actor hive )) +(define our-proog (hive-create-actor hive )) +(ez-run-hive hive + (list (hive-bootstrap-message hive our-emo 'greet-proog + #:target our-proog)))