diff --git a/csys/csys.lisp b/csys/csys.lisp index 36b3264..a2a0924 100644 --- a/csys/csys.lisp +++ b/csys/csys.lisp @@ -134,8 +134,8 @@ ;;;; action handlers -(defun basic-actions (&key (threshold 1)) - (list :value (value-add :threshold threshold) +(defun basic-actions () + (list :value (value-add) :create (create) :connect (connect) :next (no-op :no-forward t))) @@ -149,7 +149,7 @@ (setf (value scope) (shape:data-value msg :value)) (values msg scope))) -(defun value-add (&key (bias 0) (threshold 0)) +(defun value-add (&key (bias 0) (threshold 1)) (lambda (msg scope) (let* ((val (getf (shape:data msg) :value)) (newval (+ val (value scope)))) diff --git a/csys/program.lisp b/csys/program.lisp index 4fcfd0c..3133121 100644 --- a/csys/program.lisp +++ b/csys/program.lisp @@ -37,14 +37,15 @@ (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) + '(:e00 :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" :connect :succ) - (csys:send-create self :cat :e00 :loc "1-1" :connect :succ :op (csys:multiply -1)) + (csys:send-create self :cat :e00 :loc "1-0" :value 2 :connect :succ) + (csys:send-create self :cat :e00 :loc "1-1" :value 2 + :connect :succ :op (csys:multiply -1)) (csys:send-create self :cat :s00 :loc "0-1" :stage :basic) ;; switch :active nil))) diff --git a/scratch.lisp b/scratch.lisp index 640ce83..a53a59c 100644 --- a/scratch.lisp +++ b/scratch.lisp @@ -1,17 +1,28 @@ -;;; cl-scopes/scratch - interactive testing +;;;; cl-scopes/scratch - interactive testing -(asdf:load-system :scopes) +;(asdf:load-system :scopes) +(asdf:load-system :scopes-csys) -(in-package :cl-user) +;(in-package :cl-user) (use-package :trivial-package-local-nicknames) -;;; real scratch area +;;;; csys stuff + +(add-package-local-nickname :environ :scopes/csys/environ) +(add-package-local-nickname :program :scopes/csys/program) + +(scopes/util/async:init) +(setf environ:*env* (environ:simple-setup (program:config-basic-1))) + +;(environ:send-value '(:s00 "0-1") 2) + +;;;; iterator experiments - obsolete? (defun make-iter () (let ((pointers (vector nil nil nil))) - #'(lambda (fn) - (funcall fn pointers)))) + (lambda (fn) + (funcall fn pointers)))) (defun iter-current (it) - (funcall it #'(lambda (p) (car (svref p 0))))) + (funcall it (lambda (p) (car (svref p 0))))) diff --git a/test/test-csys.lisp b/test/test-csys.lisp index 008a314..36e2404 100644 --- a/test/test-csys.lisp +++ b/test/test-csys.lisp @@ -31,7 +31,7 @@ (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))) + (config:add-action '(:csys :effect :e00) (value-in '(1 2 3 4))) ;(config:add-action '(:csys :effect) #'tc:check-message) (config:add-action '(:csys) (constantly nil)))