From 543704f0f54cbb1de78754ad8a323c482ab6829c Mon Sep 17 00:00:00 2001 From: colin Date: Sat, 14 Dec 2024 12:29:29 -0800 Subject: Loop style nits --- gui/button.lisp | 6 +++--- gui/menus.lisp | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'gui') diff --git a/gui/button.lisp b/gui/button.lisp index bebea08..dfb6a06 100644 --- a/gui/button.lisp +++ b/gui/button.lisp @@ -76,12 +76,12 @@ (macrolet ((def-accessors (&rest accessor-names) (let ((defs - (loop for accessor-name in accessor-names - collect + (loop :for accessor-name :in accessor-names + :collect `(defmethod ,accessor-name ((button button)) (,accessor-name (button-up button))) - collect + :collect `(defmethod (setf ,accessor-name) (newval (button button)) (setf (,accessor-name (button-up button)) newval (,accessor-name (button-down button)) newval) diff --git a/gui/menus.lisp b/gui/menus.lisp index a477dd9..e9188f1 100644 --- a/gui/menus.lisp +++ b/gui/menus.lisp @@ -11,7 +11,7 @@ :required :type region)) (defmethod cleanup :after ((menu menu)) - (loop for item in (menu-items menu) do (cleanup item))) + (map 'nil #'cleanup (menu-items menu))) (defmethod initialize-instance :after ((menu menu) &key) (with-slots (base-width base-height region) menu @@ -32,12 +32,12 @@ (macrolet ((def-menu-accessors (&rest accessor-names) (let ((defs - (loop for name in accessor-names - collect + (loop :for name :in accessor-names + :collect `(defmethod ,name ((menu menu)) (,name (unit-region menu))) - collect + :collect `(defmethod (setf ,name) (newval (menu menu)) (let ((diff (- newval (,name menu)))) (setf (,name (unit-region menu)) newval) @@ -96,9 +96,9 @@ (defmethod (setf vert-scroll) :after (val (vs vscroller)) (loop - for o in (menu-items vs) - for y = (+ (y vs) (height vs) val) then (- y (height o)) - do (setf (y o) y))) + :for o :in (menu-items vs) + :for y := (+ (y vs) (height vs) val) :then (- y (height o)) + :do (setf (y o) y))) (defhandler vscroller-scroll (on-mousewheel (vs horiz vert) @@ -110,7 +110,7 @@ (- oh h)))))) (defun vscroller-items-height (vs) - (loop for o in (menu-items vs) summing (height o))) + (loop :for o :in (menu-items vs) :summing (height o))) (defmethod add-menu-item :before ((vs vscroller) item) (setf (x item) (x vs) -- cgit v1.2.3