If anyone are interested, I found a solution for lazy lists. A simplified
version of their construction and access looks like this:
nil <- function() NULL
cons <- function(car, cdr) {
force(car)
force(cdr)
function() list(car = car, cdr = cdr)
}
is_nil <- function(lst) is.null(lst())
car <
There is no way that I have the tenacity to wade through your verbiage
(maybe other hardier souls will). However, it sounds like you are
trying to reinvent wheels. I think you want: ?substitute.
> f <- function(exp)substitute(exp)
> f(1:100)
1:100
see also ?delayedAssign for direct manipulation o
Hi, I’m playing around with ways of implementing lazy evaluation of
expressions. In R, function arguments are evaluated as promises but expressions
are evaluated immediately, so I am trying to wrap expressions in
thunks—functions with no arguments that evaluate an expression—to get something
th
3 matches
Mail list logo