Passing information between nodes
I'd like to use agnostic-lizard to write a portable implementation of fbind
which rewrites the source forms. My idea can be summed up like that:
- Walk the code and rewrite it
-
FBIND
: add names to the list of lexicallyFBIND
-bound functions and bind lexivars to the function objects -
LABELS
/FLET
: remove names from the list of lexicallyFBIND
-bound functions -
FUNCTION
: is the nameFBIND
-bound?- yes: expand into a lexivar
- no: keep as-is
- function calls: is the name
FBIND
-bound?- yes: expand into a
FUNCALL
of a lexivar - no: keep as-is
- yes: expand into a
-
This means that, as I walk a Lisp form, I need to maintain a list of lexically FBIND
-bound functions, "rebind" it in some nodes of the tree, and access that list later on. How can I do that using agnostic-lizard?