From dc124a6effb045956725f6d4ec5b70cc365cd3b8 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Sat, 15 Aug 2026 14:42:24 +0200 Subject: [PATCH] csys, work in progress: retire neurons, improve location (space) stuff, ... --- csys/csys.lisp | 23 ++++++++++++++++++----- scopes-core.asd | 1 - scratch.lisp | 2 ++ test/test-core.lisp | 3 ++- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/csys/csys.lisp b/csys/csys.lisp index c625613..c0fa67e 100644 --- a/csys/csys.lisp +++ b/csys/csys.lisp @@ -95,6 +95,7 @@ (defun synapse (rcvr &optional op) (lambda (msg) + ;(if (eql (message:domain msg) :_meta) (setf op (handle-syn-meta msg rcvr op)) (...)) (let ((nmsg (if op (funcall op msg) msg))) (when nmsg (actor:send rcvr nmsg))))) @@ -157,7 +158,7 @@ (lambda (msg scope) (let* ((val (getf (shape:data msg) :value)) (newval (+ val (value scope)))) - (util:lgi newval (length (syns scope))) + ;(util:lgi newval (length (syns scope))) (if (>= newval threshold) (let* ((head (new-msg-head msg scope)) (msg (message:create head :data (list :value newval)))) @@ -179,9 +180,9 @@ (defun connect () (lambda (msg scope) - (let ((data (shape:data msg))) - (setf (syns scope) - (cons (synapse (getf data :target) (getf data :op)) (syns scope))) + (let* ((data (shape:data msg)) + (syn (synapse (getf data :target) (getf data :op)))) + (push syn (syns scope)) (values nil scope)))) (defun switch (&key (default :active)) @@ -189,9 +190,21 @@ (let ((data (shape:data msg))) (setf (stage scope) (getf data :stage default)) (set-proc scope) - (util:lgi (stage scope) (proc scope) (syns scope)) + ;(util:lgi (stage scope) (proc scope) (syns scope)) (values nil scope)))) +(defun retire (msg scope) + ;(environ:unregister *self*) + ;(environ:remove-pred-syns *self*) + (setf (stage scope) :retired) + (setf (syns scope) nil) + (setf (proc scope) + (lambda (msg scope) + (util:lgw "message for retired cell" msg scope) + ;(notify ...) + nil)) + (values nil scope)) + ;;;; synapse ops (defun multiply (n) diff --git a/scopes-core.asd b/scopes-core.asd index a75b90f..d7dc318 100644 --- a/scopes-core.asd +++ b/scopes-core.asd @@ -17,7 +17,6 @@ "core/actor" "core/message" "forge/forge" "logging" "util/async" "util/util")) - (:file "csys/csys" :depends-on ("core/core")) (:file "core/message" :depends-on ("core/actor" "shape/shape")) (:file "forge/forge" :depends-on ("util/iter" "util/util")) (:file "logging" :depends-on ("config" "util/util")) diff --git a/scratch.lisp b/scratch.lisp index 1c1b0a9..496f267 100644 --- a/scratch.lisp +++ b/scratch.lisp @@ -10,6 +10,8 @@ (add-package-local-nickname :basic :scopes/csys/program/basic) (add-package-local-nickname :environ :scopes/csys/environ) +(add-package-local-nickname :message :scopes/core/message) +(add-package-local-nickname :shape :scopes/shape) (scopes/util/async:init) (setf environ:*env* (environ:simple-setup (basic:config-b2))) diff --git a/test/test-core.lisp b/test/test-core.lisp index bd9c946..2c6c458 100644 --- a/test/test-core.lisp +++ b/test/test-core.lisp @@ -1,4 +1,5 @@ -;;;; cl-scopes/test-core - testing for the scopes-core system. +;;;; cl-scopes/test-core - testing for the scopes-core system +;;;; including shape and util packages. (defpackage :scopes/test-core (:use :common-lisp)