Re: [Rd] Different serialization of functions in interactive vs. batch mode

2015-02-18 Thread Holger Hoefling
Hi Gabriel, thanks for your reply - it does solve the problem of my toy function, but does come with some other problems though. a) as.list(f)[[1]] yields an expression, not a function. In order to go the route you are suggesting, I would more likely use "deparse" in order to get the original back

Re: [Rd] Different serialization of functions in interactive vs. batch mode

2015-02-18 Thread Gabriel Becker
On Wed, Feb 18, 2015 at 6:43 AM, Holger Hoefling wrote: > > b) and more seriously - as.list strips the environment of the function > (and thus associated information) as well as information about parent > environments. For the execution of a function, this would however be > crucial. This is also

Re: [Rd] Different serialization of functions in interactive vs. batch mode

2015-02-18 Thread Holger Hoefling
Luke, thank you so much - that solves my problem! Holger On Wed, Feb 18, 2015 at 3:56 PM, wrote: > On Wed, 18 Feb 2015, Holger Hoefling wrote: > >> Hi Luke, >> >> Ah - I see - thank you! This at least points me to a way on how to >> "fix" this. I tried setting the srcref attribute to NULL, but

Re: [Rd] Different serialization of functions in interactive vs. batch mode

2015-02-18 Thread luke-tierney
On Wed, 18 Feb 2015, Holger Hoefling wrote: Hi Luke, Ah - I see - thank you! This at least points me to a way on how to "fix" this. I tried setting the srcref attribute to NULL, but the hash value is still different and so is the serialization. So this looks like it is one difference, but not a

Re: [Rd] Different serialization of functions in interactive vs. batch mode

2015-02-18 Thread Gabriel Becker
Holger, For me (see session info) using digest(as.list(f)) gets around this problem. ~G > sessionInfo() R version 3.1.0 (2014-04-10) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONET

Re: [Rd] Different serialization of functions in interactive vs. batch mode

2015-02-18 Thread Holger Hoefling
Hi Luke, Ah - I see - thank you! This at least points me to a way on how to "fix" this. I tried setting the srcref attribute to NULL, but the hash value is still different and so is the serialization. So this looks like it is one difference, but not all of them Even if all differences were identi

Re: [Rd] Different serialization of functions in interactive vs. batch mode

2015-02-18 Thread luke-tierney
Add attributes(testfun) and you will see where the two functions differ. luke On Wed, 18 Feb 2015, Holger Hoefling wrote: Hi, I posted this question to the regular help list, but it seems to be this is probably a question that is better addressed on r-devel. Sorry for the double posting. I

[Rd] Different serialization of functions in interactive vs. batch mode

2015-02-18 Thread Holger Hoefling
Hi, I posted this question to the regular help list, but it seems to be this is probably a question that is better addressed on r-devel. Sorry for the double posting. I am using hash-values to cache certain results in R. This caching also depends on the hash-value of the function that is being ca