Displaying 2 results from an estimated 2 matches for "call_forc".
Did you mean:
call_forced
2015 Mar 01
1
iterated lapply
...n R function like "apply" is
implemented leak into its semantics. That's what's going on with
the Reduce bug (16093) too.
I think one can avoid this by defining the following function for
calling a function with evaluation of arguments forced (ie, lazy
evaluation disabled):
call_forced <- function (f, ...) { list (...); f (...) }
(Of course, for speed one could make this a primitive function, which
wouldn't actually build a list.)
Then the critical code in Reduce could be changed from
for (i in rev(ind)) init <- f(x[[i]], init)
to
for (i in rev(ind)) init <...
2015 Mar 01
2
iterated lapply
I think the discussion of this issue has gotten more complicated than
necessary.
First, there really is a bug. You can see this also by the fact that
delayed warning messages are wrong. For instance, in R-3.1.2:
> lapply(c(-1,2,-1),sqrt)
[[1]]
[1] NaN
[[2]]
[1] 1.414214
[[3]]
[1] NaN
Warning messages:
1: In FUN(c(-1, 2, -1)[[3L]], ...) : NaNs produced
2: In