;;;; cl-scopes/shape - really abstract basic data shape definitions. (defpackage :scopes/shape (:use :common-lisp) (:local-nicknames (:util :scopes/util)) (:export #:record #:head-fields #:head #:data #:head-plist)) (in-package :scopes/shape) (defclass record () ((head-fields :reader head-fields :initarg :head-fields :initform '(:taskid :username) :allocation :class) (head :reader head :initarg :head) (data :accessor data :initarg :data :initform nil))) (defmethod initialize-instance :after ((rec record) &key head &allow-other-keys) (setf (slot-value rec 'head) (util:rfill (head-fields rec) head))) (defun head-plist (rec) (let (pl (hv (head rec))) (dolist (hf (head-fields rec)) (setf pl (cons hf (cons (util:keyword-to-string (pop hv)) pl)))) pl))