From 0cca279545bc465667da9da88ff95a3bbe4ba27e Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Sun, 9 Aug 2026 14:25:49 +0200 Subject: [PATCH] csys/program, tests: consistent naming of categories in basic-0 and basic-1 --- csys/csys.lisp | 4 +++- csys/environ.lisp | 2 +- csys/program.lisp | 26 +++++++++++++------------- test/test-csys.lisp | 12 ++++++------ 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/csys/csys.lisp b/csys/csys.lisp index a2a0924..43d286c 100644 --- a/csys/csys.lisp +++ b/csys/csys.lisp @@ -204,7 +204,9 @@ (send-message cell (list domain :connect) (list :target target :op op))) (defun printer () - (actor:create (lambda (msg) (print msg)))) + (actor:create + (lambda (msg) + (format t "~&~s~%" msg)))) ;;;; internal helpers diff --git a/csys/environ.lisp b/csys/environ.lisp index 6cbc0f0..da06583 100644 --- a/csys/environ.lisp +++ b/csys/environ.lisp @@ -20,7 +20,7 @@ (defclass scope (csys:scope) ((cells :reader cells :initform (make-hash-table :test #'equal)))) -(defun create (proc meta-env &key eff-contacts) ; meta-env example: (csys:printer) +(defun create (proc meta-env &key eff-contacts) (let* ((prg (csys:make-program proc)) (scope (csys:scope prg meta-env :cls 'scope :categ '(:env :c00))) (env (csys:neuron scope))) diff --git a/csys/program.lisp b/csys/program.lisp index 3133121..4a327aa 100644 --- a/csys/program.lisp +++ b/csys/program.lisp @@ -15,14 +15,14 @@ (defun basic-0 () (csys:make-program (list '(:c00 :initial) (csys:std-proc :next (b0-next-zero)) - '(:e01 :initial) (csys:eff-proc) + '(:e00 :initial) (csys:eff-proc) ':default (csys:std-proc)))) (defun b0-next-zero () (lambda (msg scope) (let ((self actor:*self*)) - (csys:send-create self :cat :e01 :connect :succ) - (csys:send-create self :cat :s01 :loc "0-1" :connect :pred) + (csys:send-create self :cat :e00 :connect :succ) + (csys:send-create self :cat :s00 :loc "0-1" :connect :pred) (csys:send-connect self self :op (csys:multiply -1)) ;; switch :active nil))) @@ -30,23 +30,23 @@ ;;;; basic-1: minimal cross-linked system (defun config-basic-1 () - (list (basic-1) :zero-cat :s00 - :eff-contacts '(:e00 ("1-0" "1-1")))) + (list (basic-1) :zero-cat :s01 + :eff-contacts '(:e01 ("1-0" "1-1")))) (defun basic-1 () (csys:make-program - (list '(:s00 :initial) (csys:std-proc :next (b1-next-zero)) - '(:s00 :basic) (csys:std-proc :next (b1-next-one)) - '(:e00 :default) (csys:eff-proc :value (csys:value-add :bias 2)) + (list '(:s01 :initial) (csys:std-proc :next (b1-next-zero)) + '(:s01 :basic) (csys:std-proc :next (b1-next-one)) + '(:e01 :default) (csys:eff-proc :value (csys:value-add :bias 2)) ':default (csys:std-proc)))) (defun b1-next-zero () (lambda (msg scope) (let ((self actor:*self*)) - (csys:send-create self :cat :e00 :loc "1-0" :value 2 :connect :succ) - (csys:send-create self :cat :e00 :loc "1-1" :value 2 + (csys:send-create self :cat :e01 :loc "1-0" :value 2 :connect :succ) + (csys:send-create self :cat :e01 :loc "1-1" :value 2 :connect :succ :op (csys:multiply -1)) - (csys:send-create self :cat :s00 :loc "0-1" :stage :basic) + (csys:send-create self :cat :s01 :loc "0-1" :stage :basic) ;; switch :active nil))) @@ -54,8 +54,8 @@ (lambda (msg scope) (let ((self actor:*self*) (env (csys:environ scope))) - (environ:send-connect env :to self :target '(:csys :e00 "1-0") + (environ:send-connect env :to self :target '(:csys :e01 "1-0") :op (csys:multiply -1)) - (environ:send-connect env :to self :target '(:csys :e00 "1-1")) + (environ:send-connect env :to self :target '(:csys :e01 "1-1")) ;; switch :active nil))) diff --git a/test/test-csys.lisp b/test/test-csys.lisp index 36e2404..5a9e069 100644 --- a/test/test-csys.lisp +++ b/test/test-csys.lisp @@ -30,8 +30,8 @@ (defun setup-config () (config:add :test-receiver :setup #'tc:setup) - (config:add-action '(:csys :effect :e01) (value-in '(1 2))) - (config:add-action '(:csys :effect :e00) (value-in '(1 2 3 4))) + (config:add-action '(:csys :effect :e00) (value-in '(1 2))) + (config:add-action '(:csys :effect :e01) (value-in '(1 2 3 4))) ;(config:add-action '(:csys :effect) #'tc:check-message) (config:add-action '(:csys) (constantly nil))) @@ -71,15 +71,15 @@ ;(rcvr (tc:receiver t:*test-suite*)) (sleep 0.1) ;(tc:expect rcvr (message:create '(:csys :effect :e01) :data '(:value 1))) - (environ:send-value '(:s01 "0-1") 1) - (environ:send-value '(:s01 "0-1") 2) + (environ:send-value '(:s00 "0-1") 1) + (environ:send-value '(:s00 "0-1") 2) (sleep 0.1) (core:shutdown))) (deftest test-basic-1 () (let ((environ:*env* (setup-test (program:config-basic-1)))) (sleep 0.1) - (environ:send-value '(:s00 "0-0") 1) - (environ:send-value '(:s00 "0-1") 2) + (environ:send-value '(:s01 "0-0") 1) + (environ:send-value '(:s01 "0-1") 2) (sleep 0.1) (core:shutdown)))