diff --git a/Makefile b/Makefile index ec4626c..b3afe1e 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,5 @@ -# PACKAGES=syndicate syndicate-examples -# COLLECTS=syndicate syndicate-examples - -PACKAGES=syndicate -COLLECTS=syndicate +PACKAGES=syndicate syndicate-examples +COLLECTS=syndicate syndicate-examples all: setup diff --git a/OLD-syndicate-examples/box-and-client.rkt b/OLD-syndicate-examples/box-and-client.rkt deleted file mode 100644 index d5c18bd..0000000 --- a/OLD-syndicate-examples/box-and-client.rkt +++ /dev/null @@ -1,21 +0,0 @@ -#lang syndicate -;; Simple mutable box and count-to-infinity box client. - -(message-struct set-box (new-value)) -(assertion-struct box-state (value)) - -(spawn (field [current-value 0]) - (assert (box-state (current-value))) - (stop-when-true (= (current-value) 10) - (log-info "box: terminating")) - (on (message (set-box $new-value)) - (log-info "box: taking on new-value ~v" new-value) - (current-value new-value))) - -(spawn (stop-when (retracted (observe (set-box _))) - (log-info "client: box has gone")) - (on (asserted (box-state $v)) - (log-info "client: learned that box's value is now ~v" v) - (send! (set-box (+ v 1)))) - (on (retracted (box-state _)) - (log-info "client: box state disappeared"))) diff --git a/OLD-syndicate-examples/info.rkt b/OLD-syndicate-examples/info.rkt deleted file mode 100644 index 476c0a1..0000000 --- a/OLD-syndicate-examples/info.rkt +++ /dev/null @@ -1,18 +0,0 @@ -#lang setup/infotab -(define collection "syndicate-examples") - -(define deps '("base" - "syndicate" - "bitsyntax" - "packet-socket" - "compatibility-lib" - "data-lib" - "gui-lib" - "htdp-lib" - "images-lib" - "net-lib" - "pict-lib" - "plot-lib" - "srfi-lite-lib")) - -(define build-deps '("rackunit-lib")) diff --git a/syndicate-examples/box-and-client.rkt b/syndicate-examples/box-and-client.rkt new file mode 100644 index 0000000..02deb97 --- /dev/null +++ b/syndicate-examples/box-and-client.rkt @@ -0,0 +1,26 @@ +#lang syndicate +;; Simple mutable box and count-to-infinity box client. + +(struct set-box (new-value) #:prefab) +(struct box-state (value) #:prefab) + +(actor-system/dataspace (ds) + (spawn #:name 'box + (define-field current-value 0) + (at ds + (assert (box-state (current-value))) + (when (message (set-box $new-value)) + (log-info "box: taking on new-value ~v" new-value) + (current-value new-value))) + (stop-when-true (= (current-value) 10) + (log-info "box: terminating"))) + + (spawn #:name 'client + (at ds + (stop-when (retracted (Observe (:pattern (set-box ,_)) _)) + (log-info "client: box has gone")) + (when (asserted (box-state $v)) + (log-info "client: learned that box's value is now ~v" v) + (send! ds (set-box (+ v 1)))) + (when (retracted (box-state _)) + (log-info "client: box state disappeared"))))) diff --git a/syndicate-examples/info.rkt b/syndicate-examples/info.rkt new file mode 100644 index 0000000..3928de7 --- /dev/null +++ b/syndicate-examples/info.rkt @@ -0,0 +1,24 @@ +#lang setup/infotab +(define collection "syndicate-examples") + +(define deps '( + + "base" + + "syndicate" + + ;; "bitsyntax" + ;; "packet-socket" + ;; "compatibility-lib" + ;; "data-lib" + ;; "gui-lib" + ;; "htdp-lib" + ;; "images-lib" + ;; "net-lib" + ;; "pict-lib" + ;; "plot-lib" + ;; "srfi-lite-lib" + + )) + +;; (define build-deps '("rackunit-lib")) diff --git a/syndicate/lang.rkt b/syndicate/lang.rkt new file mode 100644 index 0000000..dcf6ce6 --- /dev/null +++ b/syndicate/lang.rkt @@ -0,0 +1,10 @@ +#lang racket/base + +(provide (all-from-out racket/base) + (all-from-out racket/match) + (all-from-out "main.rkt") + (all-from-out "dataspace.rkt")) + +(require racket/match) +(require "main.rkt") +(require "dataspace.rkt") diff --git a/syndicate/main.rkt b/syndicate/main.rkt index 423d1b5..9a6a12d 100644 --- a/syndicate/main.rkt +++ b/syndicate/main.rkt @@ -11,4 +11,4 @@ (require preserves) (require (only-in "pattern.rkt" :pattern :template)) -;; (module reader syntax/module-reader syndicate/lang) +(module reader syntax/module-reader syndicate/lang)