From a4411bcc3919c2099934fd49664ee689460ebf80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Manuel=20Tom=C3=A1s?= Date: Fri, 1 May 2026 14:16:07 -0300 Subject: Update libraries --- def.lisp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 def.lisp (limited to 'def.lisp') diff --git a/def.lisp b/def.lisp new file mode 100644 index 0000000..18fcd9e --- /dev/null +++ b/def.lisp @@ -0,0 +1,17 @@ +(in-package #:def) + +(defmacro defclass (name parents &body simple-slots) + (let (slots) + (dolist (slot simple-slots) + (if (symbolp slot) + (push `(,slot :initarg ,(intern (symbol-name slot) 'keyword) :accessor ,slot) slots) + (let ((slot-name (first slot)) + (slot-type (second slot)) + (slot-form (third slot))) + (cond ((and slot-type slot-form) + (push `(,slot-name :initarg ,(intern (symbol-name slot-name) 'keyword) :accessor ,slot-name :type ,slot-type :initform ,slot-form) slots)) + (slot-type + (push `(,slot-name :initarg ,(intern (symbol-name slot-name) 'keyword) :accessor ,slot-name :type ,slot-type) slots)) + (t + (push `(,slot-name :initarg ,(intern (symbol-name slot-name) 'keyword) :accessor ,slot-name) slots)))))) + `(cl:defclass ,name ,parents ,slots))) -- cgit v1.2.3