2024-05-25 16:26:26 +00:00
|
|
|
(uiop:define-package #:hsx/hsx
|
|
|
|
(:use #:cl)
|
2024-05-28 03:33:01 +00:00
|
|
|
(:export #:hsx))
|
2024-05-25 16:26:26 +00:00
|
|
|
(in-package #:hsx/hsx)
|
|
|
|
|
2024-05-26 14:29:30 +00:00
|
|
|
|
2024-05-27 08:00:58 +00:00
|
|
|
(defmacro hsx (&body form)
|
|
|
|
(when (not (= (length form) 1))
|
|
|
|
(error "The body of the hsx macro must be a single form."))
|
|
|
|
(find-builtin-symbols (car form)))
|
2024-05-26 10:48:09 +00:00
|
|
|
|
2024-05-27 10:11:27 +00:00
|
|
|
(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)))))
|