search for: do_asfunct

Displaying 3 results from an estimated 3 matches for "do_asfunct".

2017 Aug 04
2
Why is as.function() slower than eval(call("function"())?
....03029 3.6655 3.9615 27.499 100 c # make_fn_weird(a, b_wrapped) 3.354 3.5005 3.77190 3.6405 3.9425 6.839 100 c # make_fn_weirder(a_b) 2.488 2.6290 2.83352 2.7215 2.8800 7.007 100 b One IRC user pointed out that as.function() takes its own path through the code, namely do_asfunction() (in src/main/coerce.c). What is it about this code path that's 50% slower than whatever happens during eval(call("function", a, b))? Obviously this is a trivial micro-optimization and it doesn't matter to 99% of users. Mostly asking out of curiosity, but also wondering if th...
2000 Nov 22
0
How do you construct a function from a list? (PR#743)
...(withargs)) function (x) for (i in 1) junk() For a function with no arguments, it doesn't: > noargs <- function() for (i in 1) junk() > noargs function () for (i in 1) junk() > as.function(as.list(noargs)) function () list(for (i in 1) junk()) I looked at the source (do_asfunction in main/coerce.c), but couldn't understand what was going on well enough to figure out the bug. Duncan Murdoch --please do not edit the information below-- Version: platform = Windows arch = x86 os = Win32 system = x86, Win32 status = major = 1 minor = 1.1 year = 2000 month = A...
2011 Jun 30
1
invalid body argument for function
Hi guys, Looks like mkCLOSXP cannot handle external pointers as the function body. Work around is obvious, but I guess it's a bug nonetheless. > library(RGtk2) > fun <- eval(substitute(function() x, list(x = gtkWindow()))) Error in eval(expr, envir, enclos) : invalid body argument for "function" Should NEVER happen; please bug.report() [mkCLOSXP] > sessionInfo() R