Improve find-builtin-symbols

This commit is contained in:
paku 2024-05-27 19:11:27 +09:00
parent 458785bfb1
commit d10b24c2c8

View file

@ -45,15 +45,13 @@
(error "The body of the hsx macro must be a single form."))
(find-builtin-symbols (car form)))
(defun find-builtin-symbols (tree)
(if tree
(cons (let ((first-node (first tree)))
(if (listp first-node)
(find-builtin-symbols first-node)
(or (find-symbol (string first-node) :hsx/builtin)
first-node)))
(mapcar (lambda (node)
(if (listp node)
(find-builtin-symbols node)
node))
(rest tree)))))
(defun find-builtin-symbols (node)
(if (atom node)
(or (find-symbol (string node) :hsx/builtin)
node)
(cons (find-builtin-symbols (car node))
(mapcar (lambda (n)
(if (listp n)
(find-builtin-symbols n)
n))
(cdr node)))))