From 4d199a1d92a430aff2162c61f2ee6faee90e8bd7 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Sun, 7 Jul 2024 18:24:51 +0200 Subject: [PATCH] refactor core data types:simpliry message head, start with shape package --- core/message.lisp | 23 ++++------------------- shape.lisp | 4 ++++ 2 files changed, 8 insertions(+), 19 deletions(-) create mode 100644 shape.lisp diff --git a/core/message.lisp b/core/message.lisp index 294c8ce..0eb5a3d 100644 --- a/core/message.lisp +++ b/core/message.lisp @@ -8,14 +8,6 @@ (in-package :scopes/core/message) -;;;; message-head - -(defclass message-head () - ((domain) - (action) - (class) - (item))) - ;;;; message (defclass message () @@ -24,18 +16,11 @@ (timestamp) (data :accessor data :initarg :data :initform nil))) -(defun create (head-vals &key data sender) - (let ((h (make-instance 'message-head))) - (dolist (sl '(domain action class item)) - (setf (slot-value h sl) (pop head-vals))) - (make-instance 'message :head h :data data :sender sender))) +(defun create (head &key data sender) + (make-instance 'message :head head :data data :sender sender)) (defmethod print-object ((msg message) stream) - (with-slots (domain action class item) (head msg) - (format stream - ">" - domain action class item (sender msg) (data msg)))) + (format stream ">" (head msg) (sender msg) (data msg))) (defun head-as-list (msg) - (with-slots (domain action class item) (head msg) - (list domain action class item))) + (head msg)) diff --git a/shape.lisp b/shape.lisp new file mode 100644 index 0000000..e26f946 --- /dev/null +++ b/shape.lisp @@ -0,0 +1,4 @@ +;;;; cl-scopes/shape - really abstract basic data shape definitions. + +(defpackage :scopes/shape + (:use :common-lisp))