> > > if you want this^ to be actually defined while compilation is

> > > happening (i.e. in the compilation stage; see staged computing), then

> > > you need to use an (eval-when (expand) ...) wrapper around it.

>

>

> > Thank you for the reply! Not sure what you mean. The following code

> > defines `a`:

>i ran with some ungrounded assumptions, and i basically explained how it works in CL, not in Guile.

 

It works like that in (Guile) Scheme too. Though, to be precise, ‘expand’ refers to the macro expansion phase, whether compiling or not. ‘compile’ is for “evaluate during macro expansion, but not only when compiling”.

 

>[...]

>i briefly tired to find the place where DEFINE is compiled to check this hypothesis in the code, but i couldn't find it.

 

In macro-expansion:

 

Evaluation:

 

In Tree-IL:

* https://git.savannah.gnu.org/cgit/guile.git/tree/module/language/tree-il.scm#n220

* https://git.savannah.gnu.org/cgit/guile.git/tree/module/language/tree-il.scm#n310

 

Also maybe see relevant optimisation code and other layers of the compilation tower.