Rename to modify-first-of-lists

This commit is contained in:
paku 2024-05-27 15:01:46 +09:00
parent 3a6475df6a
commit e18c9097e2

View file

@ -67,23 +67,23 @@
;;;; hsx macro to find hsx symbols ;;;; hsx macro to find hsx symbols
(defmacro hsx (form) (defmacro hsx (form)
(modify-first-leaves form (modify-first-of-lists form
#'builtin-element-p #'builtin-element-p
(lambda (node) (lambda (node)
(find-symbol (string node) :hsx/hsx)))) (find-symbol (string node) :hsx/hsx))))
(defun modify-first-leaves (tree test result) (defun modify-first-of-lists (tree test result)
(if tree (if tree
(cons (let ((first-node (first tree))) (cons (let ((first-node (first tree)))
(cond (cond
((listp first-node) ((listp first-node)
(modify-first-leaves first-node test result)) (modify-first-of-lists first-node test result))
((funcall test first-node) ((funcall test first-node)
(funcall result first-node)) (funcall result first-node))
(t first-node))) (t first-node)))
(mapcar (lambda (node) (mapcar (lambda (node)
(if (listp node) (if (listp node)
(modify-first-leaves node test result) (modify-first-of-lists node test result)
node)) node))
(rest tree))))) (rest tree)))))