hsx/src/hsx.lisp

23 lines
665 B
Common Lisp
Raw Normal View History

2024-05-28 11:15:29 +00:00
(defpackage #:hsx/hsx
2024-05-25 16:26:26 +00:00
(:use #:cl)
(:export #:hsx))
2024-05-25 16:26:26 +00:00
(in-package #:hsx/hsx)
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 (and (symbolp node)
(not (keywordp node))
(find-symbol (string node) :hsx/builtin))
2024-05-27 10:11:27 +00:00
node)
(cons (find-builtin-symbols (car node))
(mapcar (lambda (n)
(if (listp n)
(find-builtin-symbols n)
n))
(cdr node)))))