[R] lazy evaluation (was RE: Number of replications of a term)

2006-01-24 Thread Liaw, Andy
From: Thomas Lumley > > On Wed, 25 Jan 2006, Ray Brownrigg wrote: > > > There's an even faster one, which nobody seems to have > mentioned yet: > > > > rep(l <- rle(ids)$lengths, l) > > I considered this but it wasn't clear to me from the initial > post that > each ID occupied a contiguous se

Re: [R] Lazy Evaluation?

2004-06-08 Thread John Chambers
No, not lazy evaluation. The explanation has to do with environments and how callGeneric works. It's an interesting (if obscure) example. Here's the essence of it, embedded in some comments on debugging and on style. (This will be a fairly long discussion, I'm afraid.) A useful starting point

[R] Lazy Evaluation?

2004-06-07 Thread Thomas Stabla
Hello, I've stumbled upon following problem, when trying to overload the methods for group Math for an S4-class which contains functions as slots. setClass("NumFunction", representation = list(fun = "function")) NumFunction <- function(f) new("NumFunction", fun = f) square <- function(x)