[Rd] all.equal() applied to function closures -- now committed

2020-12-04 Thread Martin Maechler
> Martin Maechler > on Thu, 3 Dec 2020 18:29:58 +0100 writes: > Martin Maechler > on Tue, 1 Dec 2020 10:31:36 +0100 writes: > Bill Dunlap > on Mon, 30 Nov 2020 13:41:54 -0800 writes: >>> To make the comparison more complete, >>> all.equal.environmen

Re: [Rd] all.equal applied to function closures

2020-12-03 Thread Martin Maechler
> Martin Maechler > on Tue, 1 Dec 2020 10:31:36 +0100 writes: > Bill Dunlap > on Mon, 30 Nov 2020 13:41:54 -0800 writes: >> To make the comparison more complete, >> all.equal.environment could compare the parents of the >> target and current environments. Th

Re: [Rd] all.equal applied to function closures

2020-12-01 Thread Abby Spurdle
> Bill, I'm sure you've noticed that we did write all.equal.environment() > to work recursively... Actually, I had worked quite a bit at > that, too long ago to remember details, but the relevant svn log > entry is > > r66640

Re: [Rd] all.equal applied to function closures

2020-12-01 Thread Duncan Murdoch
One more comment: it might be worthwhile reporting on a case where identical(e1, e2) fails when those are the environments associated with two functions (though I think not by default in all.equal.environment). Functions can modify variables in their environment, so examples like the open.acc

Re: [Rd] all.equal applied to function closures

2020-12-01 Thread Bill Dunlap
Probably all.equal.environment's do1() could be enhanced to do the recursion (and look at the environments' attributes). I wrote a separate function because it was easier to experiment that way (e.g., when to stop recursing - it stops when one environment is a top-level environment or the empty en

Re: [Rd] all.equal applied to function closures

2020-12-01 Thread Martin Maechler
> Bill Dunlap > on Mon, 30 Nov 2020 13:41:54 -0800 writes: > To make the comparison more complete, all.equal.environment could compare > the parents of the target and current environments. That would have to be > recursive but could stop at the first 'top level environmen

Re: [Rd] all.equal applied to function closures

2020-11-30 Thread Bill Dunlap
To make the comparison more complete, all.equal.environment could compare the parents of the target and current environments. That would have to be recursive but could stop at the first 'top level environment' (the global, empty, or a package-related environment generally) and use identical there.

Re: [Rd] all.equal applied to function closures

2020-11-30 Thread Duncan Murdoch
On 30/11/2020 1:05 p.m., Kevin Van Horn via R-devel wrote: Consider the following code: f <- function(x)function(y){x+y} all.equal(f(5), f(0)) This returns TRUE, when it should return FALSE; I think it’s hard to make the case that f(5) and f(0) are “approximately equal” in any meanin

[Rd] all.equal applied to function closures

2020-11-30 Thread Kevin Van Horn via R-devel
Consider the following code: f <- function(x)function(y){x+y} all.equal(f(5), f(0)) This returns TRUE, when it should return FALSE; I think it’s hard to make the case that f(5) and f(0) are “approximately equal” in any meaningful sense. Digging into the code for all.equal(), I see that