The problem
Consider the following script written in Maxima
$ cat main.max
foo(a) ::= block(
if a = 0 then return(0) else return(1)
)$
bar(a) ::= block(
return(foo(a))
)$
foo(0);
bar(0);
Executing this script yields to
$ cat main.max | maxima --very-quiet
0
1
The question
Isn't it supposed that calling foo
by itself results the same as if it is called from another function (in this scenario, bar
)?
Here there is another example
$ cat main.max
foo(a) ::= block(disp(a))$
bar(a) ::= block(foo(a))$
foo(0)$
bar(0)$
$ cat main.max | maxima --very-quiet
0
a
In other words: Why isn't maxima
replacing the argument that is passed to bar
in the foo
function call which is located within bar
?
Additional context
This is the version that I'm currently using
$ maxima --version
Maxima 5.43.2