similar to: On implementing zero-overhead code reuse

Displaying 20 results from an estimated 2000 matches similar to: "On implementing zero-overhead code reuse"

2016 Oct 03
4
On implementing zero-overhead code reuse
Hi Frederick, I described what I meant in the post I sent to R-help (https://stat.ethz.ch/pipermail/r-help/2016-September/442174.html), but in brief, by "zero overhead" I mean that the only thing needed for library code to be accessible to client code is for it to be located in designed directory. No additional meta-files, packaging/compiling, etc. are required. Best, G. On Sun, Oct
2016 Oct 03
3
On implementing zero-overhead code reuse
On Mon, Oct 3, 2016 at 10:18 AM, <frederik at ofb.net> wrote: > Hi Kynn, > > Thanks for expanding. > > I wrote a function like yours when I first started using R. It's > basically the same up to your "new.env()" line, I don't do anything > with environmentns. I just called my function "mysource" and it's > essentially a "source
2016 Oct 04
0
On implementing zero-overhead code reuse
Check out ?klmr/modules? on Github (distinct from CRAN?s ?modules?!). It looks pretty much exactly like what you want: https://github.com/klmr/modules It has an extensive README and vignette explaining the usage. Cheers, Konrad -- Konrad Rudolph On Sun, 2 Oct 2016 at 18:31 Kynn Jones <kynnjo at gmail.com> wrote: > I'm looking for a way to approximate the
2016 Oct 03
0
On implementing zero-overhead code reuse
Hi Kynn, Thanks for expanding. I wrote a function like yours when I first started using R. It's basically the same up to your "new.env()" line, I don't do anything with environmentns. I just called my function "mysource" and it's essentially a "source with path". That allows me to find code I reuse in standard locations. I don't know why R does not
2016 Oct 03
2
On implementing zero-overhead code reuse
On 10/03/2016 01:51 PM, Kynn Jones wrote: > Thank you all for your comments and suggestions. > > @Frederik, my reason for mucking with environments is that I want to > minimize the number of names that import adds to my current > environment. For instance, if module foo defines a function bar, I > want my client code to look like this: > > import("foo") >
2016 Oct 02
0
On implementing zero-overhead code reuse
Hi Kynn, Do you mind defining the term "zero-overhead model of code reuse"? I think I understand what you're getting at, but not sure. Thank you, Frederick On Sun, Oct 02, 2016 at 01:29:52PM -0400, Kynn Jones wrote: > I'm looking for a way to approximate the "zero-overhead" model of code > reuse available in languages like Python, Perl, etc. > >
2016 Oct 03
0
On implementing zero-overhead code reuse
Thank you all for your comments and suggestions. @Frederik, my reason for mucking with environments is that I want to minimize the number of names that import adds to my current environment. For instance, if module foo defines a function bar, I want my client code to look like this: import("foo") foo$bar(1,2,3) rather than import("foo") bar(1,2,3) (Just a personal
2009 May 20
10
How to google for R stuff?
Hi! I'm new to R programming, though I've been programming in other languages for years. One thing I find most frustrating about R is how difficult it is to use Google (or any other search tool) to look for answers to my R-related questions. With languages with even slightly more distinctive names like Perl, Java, Python, Matlab, OCaml, etc., usually including the name of the language
2009 May 19
4
Qs: The list of arguments, wrapping functions...
Hi. I'm pretty new to R, but I've been programming in other languages for some time. I have a couple of questions regarding programming with function objects. 1. Is there a way for a function to refer generically to all its actual arguments as a list? I'm thinking of something like the @_ array in Perl or the arguments variable in JavaScript. (By "actual" I mean the ones
2009 May 22
2
how to insert NULLs in lists?
I'm an experienced programmer, but learning R is making me lose the little hair I have left... > list(NULL) [[1]] NULL > length(list(NULL)) [1] 1 > x <- list() > x[[1]] <- NULL > x list() > length(x) [1] 0 >From the above experiment, it is clear that, although one can create a one-element list consisting of a NULL element, one can't get the same result by
2015 Dec 10
6
How do I reliably and efficiently hash a function?
I?ve got the following scenario: I need to store information about an R function, and retrieve it at a later point. In other programming languages I?d implement this using a dictionary with the functions as keys. In R, I?d usually use `attr(f, 'some-name')`. However, for my purposes I do not want to use `attr` because the information that I want to store is an implementation detail that
2015 Dec 11
1
How do I reliably and efficiently hash a function?
In addition to what Charles wrote, you can also use 'local' if you don't want a function that creates another function. > f <- local({info <- 10; function(x) x + info}) > f(3) [1] 13 best, Mark Op vr 11 dec. 2015 om 03:27 schreef Charles C. Berry <ccberry at ucsd.edu>: > On Thu, 10 Dec 2015, Konrad Rudolph wrote: > > > I?ve got the following scenario:
2005 Nov 02
2
Anything like associative arrays in R?
Let me preface my question by stressing that I am much less interested in the answer than in learning a way I could have *found the answer myself*. (As helpful as the participants in this list are, I have far too many R-related questions to resolve by posting here, and as I've written before, in my experience the R documentation has not been very helpful, but I remain hopeful that I may have
2019 Oct 09
2
S3 lookup rules changed in R 3.6.1
tl;dr: S3 lookup no longer works in custom non-namespace environments as of R 3.6.1. Is this a bug? I am implementing S3 dispatch for generic methods in environments that are not packages. I am trying to emulate the R package namespace mechanism by having a ?namespace? environment that defines generics and methods, but only exposes the generics themselves, not the methods. To make S3 lookup work
2023 Aug 27
1
Calling a replacement function in a custom environment
Hello all, I am wondering whether it?s at all possible to call a replacement function in a custom environment. From my experiments this appears not to be the case, and I am wondering whether that restriction is intentional. To wit, the following works: x = 1 base::is.na(x) = TRUE However, the following fails: x = 1 b = baseenv() b$is.na(x) = TRUE The error message is "invalid function
2005 Oct 17
4
ISO R-programming docs/refs
In my job I write custom computer programs for data analysis, which are used in our company's consulting business. Whenever I've needed statistical analyses I've coded the algorithms myself, but my boss wants me to start learning and using R, to speed up development. I am very reluctuant to do this because I can't find adequate *programming* documentation for R (though I can find
2015 Jul 15
2
bquote/evalq behavior changed in R-3.2.1
On Jul 15, 2015, at 12:51 PM, William Dunlap wrote: > I think rapply() was changed to act like lapply() in this respect. > When I looked at the source of the difference, it was that typeof() returned 'language' in 3.2.1, while it returned 'list' in the earlier version of R. The first check in rapply's code in both version was: if (typeof(object) != "list")
2015 Jul 15
3
bquote/evalq behavior changed in R-3.2.1
In 3.1.2 eval does not store the result of the bquote-generated call in the given environment. Interestingly, in 3.2.1 eval does store the result of the bquote-generated call in the given environment. In other words if I run the given example with eval rather than evalq, on 3.1.2 "x" is never stored in "fenv," but it is when I run the same code on 3.2.1. However, the given
2015 Jul 15
2
bquote/evalq behavior changed in R-3.2.1
David, If you are referring to the solution that would be: rapply(list(test), eval, envir = fenv) I thought I explained in the question that the above code does not work. It does not throw an error, but the behavior is no different (at least in the output or result). Using the above code still results in the x object not being stored in fenv on 3.1.2. Dayne On Wed, Jul 15, 2015 at 4:40 PM,
2009 Jun 25
1
R data inspection under gdb?
Hi, everyone. I'm trying to debug an R-module, written in C, and I'm using gdb for this. How can I print "standard" R objects from within C code? BTW, I'm familiar with the advice to use R_PV given in Writing R Extensions, but it's not working for me. E.g., I get (gdb) p R_PV(x) $1 = void and yet (gdb) p *x $2 = {sxpinfo = {type = 16, obj = 0, named = 0, gp = 0,