similar to: Using closures in libraries

Displaying 20 results from an estimated 4000 matches similar to: "Using closures in libraries"

2016 May 20
2
identical on closures
I'm confused by this: > identical(function() {}, function() {}) [1] FALSE Yet, after loading the Matrix package (which redefines det), the following is checked (in library.checkConflicts): > identical(get("det", baseenv()), get("det", asNamespace("Matrix")), ignore.environment=T) [1] TRUE I've looked at the code in identical.c and for closures it
2016 May 20
2
identical on closures
Specifically, the srcfile attribute of the srcref attribute of the two instances of the functions contain different environments, AFAICT. Environments are compared only by exact pointer, so this forces return FALSE. Snippets from .Internal(inspect(x)) and .Internal(inspect(y)): @cca008 03 CLOSXP g0c0 [MARK,NAM(2),ATT] FORMALS: @604b58 00 NILSXP g0c0 [MARK,NAM(2)] BODY: @cc9650 06 LANGSXP
2011 Nov 07
1
Accessing ENVSXP and CLOSXP while processing parsed R code
Hello Guys, Following up my earlier mail where I am trying to write an alternative front-end for R, I had a question about accessing the closures and environments in R code. Here's the function taken and modified a little from "*Lexical Scope and Statistical Computing*" ===================================================================== f<-function(){
2009 Dec 16
2
What is the fastest way to see what are in an RData file?
Currently, I load the RData file then ls() and str(). But loading the file takes too long if the file is big. Most of the time, I only interested what the variables are in the the file and the attributes of the variables (like if it is a data.frame, matrix, what are the colnames/rownames, etc.) I'm wondering if there is any facility in R to help me avoid loading the whole file.
2013 Jun 30
2
[LLVMdev] Implementing closures and continuations
Hi all, In getting to know the LLVM infrastructure, I'm having a hard time finding implementation details for closures and continuations. For closures, I've read comments such as "using a struct" as an environment to hold references to free variables, linked lists to dictionaries for various scope levels, and even things like "it's just like virtual methods". I
2013 Jun 30
0
[LLVMdev] Implementing closures and continuations
On Sat, Jun 29, 2013 at 7:51 PM, David Farler <accumulator at icloud.com>wrote: > Hi all, > > In getting to know the LLVM infrastructure, I'm having a hard time finding > implementation details for closures and continuations. > > For closures, I've read comments such as "using a struct" as an > environment to hold references to free variables, linked
2013 Jun 30
1
[LLVMdev] Implementing closures and continuations
> On Jun 29, 2013, at 9:53 PM, Eli Friedman <eli.friedman at gmail.com> wrote: > >> On Sat, Jun 29, 2013 at 7:51 PM, David Farler <accumulator at icloud.com> wrote: >> Hi all, >> >> In getting to know the LLVM infrastructure, I'm having a hard time finding implementation details for closures and continuations. >> >> For closures,
2013 Jan 26
0
[LLVMdev] Closures, newbie question
On 26/01/13 19:20, Torsten RĂ¼ger wrote: [...] > Just at the end it mentions closures and I was wondering how those are done in llvm. > The link was to wikipedia, and i do know what closures/blocks/continuations are, (i think) but maybe someone could point me to where to read about how to do them in llvm. I've implemented closures in the past --- it's fiddly and a surprising amount
2009 Jul 29
1
Strange Interaction Between Promises and Closures (PR#13861)
Full_Name: Keith Bare Version: 2.7.1 OS: Linux Submission from: (NULL) (128.2.134.48) I observed unexpected behavior attempting to use lapply to vary parameters in generated closures. All the generated closures ran with the last parameter value in the list. Here's a simple example: > funcs <- lapply(c("alpha", "beta", "gamma", "delta"),
2013 Jan 26
2
[LLVMdev] Closures, newbie question
So I read the Kaleidoscope tutorial, big thanks to Chris Latter. Good pace, still excellent coverage. Just at the end it mentions closures and I was wondering how those are done in llvm. The link was to wikipedia, and i do know what closures/blocks/continuations are, (i think) but maybe someone could point me to where to read about how to do them in llvm. Thanks Torsten
2010 Aug 26
1
list of closures
Hi, I wanted to create a list of closures. When I use Map(), mapply(), lapply(), etc., to create this list, it appears that the wrong arguments are being passed to the main function. For example: Main function: > adder <- function(x) function(y) x + y Creating list of closures with Map(): > plus <- Map(adder,c(one=1,two=2))> plus$one(1)[1] 3> plus$two(1)[1] 3 Examining what value
2008 Dec 28
3
[LLVMdev] Efficient implementation of closures?
A somewhat random question: I'm wondering if there's any kind of trick in LLVM that would allow me to implement closures efficiently. We can assume that a closure function has a hidden parameter which points to its environment, that is, the values of the variables which were in scope at the point where the closure function was defined. The problem comes when mixing closure and
2020 Feb 26
1
Profiling: attributing costs to place of invocation (instead of place of evaluation)?
Hi Consider the following example: f <- function(expr) g(expr) g <- function(expr) { ? h(expr) } h <- function(expr) { ? expr # evaluation happens here ? i(expr) } i <- function(expr) { ? expr # already evaluated, no costs here ? invisible() } rprof <- tempfile() Rprof(rprof) f(replicate(1e2, sample.int(1e4))) Rprof(NULL) cat(readLines(rprof), sep = "\n") #>
2008 Aug 07
1
dput function (PR#12112)
Full_Name: Juan Gea Version: R version 2.6.2 OS: Fedora Core 6 Submission from: (NULL) (79.153.48.49) Abort: objeS <- matrix("AAA",1000000) class(objeS) outTxt <- textConnection("vaClob", open = "w", local = FALSE) dput(objeS,outTxt) close(outTxt) R version 2.6.2 (2008-02-08) Copyright (C) 2008 The R Foundation for Statistical Computing ISBN
2003 Dec 16
1
Memory issues in "aggregate" (PR#5829)
Full_Name: Ed Borasky Version: 1.8.1 OS: Windows XP Professional Submission from: (NULL) (208.252.96.195) R 1.8.1 seems to be running into a memory allocation problem in the "aggregate" function. I have a rather large dataset (14 columns by 223,000 rows -- almost 40 megabytes) and a script that performs some processing on it. The system is a 768 MB Pentium 4. Here's the console
2019 Jul 24
1
Re: [PATCH libnbd v2 2/5] lib: Implement closure lifetimes.
On 7/24/19 11:54 AM, Richard W.M. Jones wrote: > Previously closures had a crude flag which tells if they are > persistent or transient. Transient closures (flag = false) last for > the lifetime of the currently called libnbd function. Persistent > closures had an indefinite lifetime which could last for as long as > the handle. In language bindings handling persistent closures
2012 Jan 19
2
What is a 'closure'?
The "R Language Definition" at http://cran.r-project.org/doc/manuals/R-lang.html states in the following section 4.3.2 Argument matching This subsection applies to closures but not to primitive functions. What are 'closures'? [[alternative HTML version deleted]]
2020 Sep 08
2
Re: [libnbd PATCH 1/2] generator: Refactor handling of closures in unlocked functions
On Mon, Sep 07, 2020 at 04:46:39PM -0500, Eric Blake wrote: > We have a memory leak when a function with a closure exits early prior > to registering that closure through some path that will guarantee > cleanup. The easiest way to fix it is to guarantee that once a > closure is passed into a public API, it will be cleaned regardless of > whether that API succeeds or fails. But to
2019 Jul 24
2
Re: [PATCH libnbd 1/3] generator: Change Closure so it describes single callbacks.
On 7/24/19 7:17 AM, Richard W.M. Jones wrote: > In preparation for closure lifetimes, split up the Closure so it no > longer describes a list of closures, but a single callback. > > This changes the API because functions which take 2 or more closures > now pass a separate user_data for each one. > --- > docs/libnbd.pod | 3 +- >
2002 Oct 14
1
R 1.6.0 Solaris crash with xmalloc: out of virtual memory
[some de-capitalization of *SXP done manually by mailing list maintainer ; the originally was caught as potential spam. MM] I have a little R program that crashes with the message xmalloc: out of virtual memory The code has a repeat{} loop that watches the sizes of some files. When there's an increase it updates things by reading the last 65 lines of each file, doing some