From f57a6588d475c74be56b1e3de7ff997466d078b7 Mon Sep 17 00:00:00 2001 From: Kevin Galligan Date: Sun, 28 Jan 2024 16:16:11 +0000 Subject: [PATCH] Change the syntax so that options go in the bindings form. --- src/sketch.lisp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/sketch.lisp b/src/sketch.lisp index 43d0690..6c8acb0 100644 --- a/src/sketch.lisp +++ b/src/sketch.lisp @@ -308,11 +308,22 @@ collect `(,(binding-accessor b) *sketch*) collect (binding-name b))))) -(defmacro defsketchx (sketch-name superclasses binding-forms &body body) - (make-defsketch sketch-name superclasses binding-forms body)) - (defmacro defsketch (sketch-name binding-forms &body body) - (make-defsketch sketch-name (list) binding-forms body)) + (multiple-value-bind (options binding-forms) + (extract-options binding-forms) + (make-defsketch sketch-name + (getf options :mixins) + binding-forms + body))) + +(defun extract-options (binding-forms) + (let (options) + (loop while (and binding-forms (keywordp (caar binding-forms))) + do (progn + (push (cadar binding-forms) options) + (push (caar binding-forms) options) + (pop binding-forms))) + (values options binding-forms))) (defun make-defsketch (sketch-name superclasses binding-forms body) (let ((bindings (parse-bindings sketch-name binding-forms