Skip to content
Prev 14158 / 398503 Next

Weird feature when creating function lists with apply

Uffe H?gsbro Thygesen <uht at dfu.min.dk> writes:
...
This part is not about lazy evaluation. This is because substitute
returns an object of mode "call", sometimes called an "unevaluated
expression", (which is a bit unfortunate because there is also an
"expression" mode, of which it is not...)

You could try picking it apart:
function
$x
1 * x
*
[..etc..]
function(x) a*x

!!! Now *that* is truly weird.... The "source" atribute for g is
getting set, seemingly out of nowhere, to something that should not be
part of f. (This is a bug, but some nasty trickery is involved in
these matters and if might be difficult to fix.)

However if we clear
function (x) 
1 * x

you can see that g is the actual function, not the call to the
function creator.