Re: [Rd] iterated lapply

2015-02-25 Thread Michael Weylandt
> On Feb 25, 2015, at 5:35 PM, Benjamin Tyner wrote: > > Actually, it depends on the number of cores: Under current semantics, yes. Each 'stream' of function calls is lazily capturing the last value of `i` on that core. Under Luke's proposed semantics (IIUC), the result would be the same (2

Re: [Rd] iterated lapply

2015-02-25 Thread Benjamin Tyner
Actually, it depends on the number of cores: > fun1 <- function(c){function(i){c*i}} > fun2 <- function(f) f(2) > sapply(mclapply(1:4, fun1, mc.cores=1L), fun2) [1] 8 8 8 8 > sapply(mclapply(1:4, fun1, mc.cores=2L), fun2) [1] 6 8 6 8 > sapply(mclapply(1:4, fun1, mc.core