3 ms·
(lambda args body) is not the same as ($vau args env body), because the latter doesn't evaluate its operands. Lambda in Kernel is defined as follows: ($defi
by pwpwp 14y ago
(lambda args body) is not the same as ($vau args env body), because the latter doesn't evaluate its operands.
Lambda in Kernel is defined as follows:
($define! $lambda
($vau (formals . body) env
(wrap (eval (list* $vau formals #ignore body)
env))))
When you say ($lambda (x) x), a new fexpr (that ignores the environment in which it is called, because lambdas don't need it) is constructed -- ($vau (x) #ignore x) -- and then it is wrapped, so that its operands are evaluated.
So,
(lambda args body)
can be expressed as
(wrap ($vau args #ignore body))