[R] identical calls are not equal !?
oehl_list@gmx.de
oehl_list at gmx.de
Wed Jun 12 16:23:01 CEST 2002
Can please someone familiar with the R internals enlighten me on the
following strange observation:
# this is IDENTICAL as expected
identical(substitute(substitute()), substitute(substitute()))
# but NOT EQUAL !????
substitute(substitute()) == substitute(substitute())
# I originally found it on
t2 <- function(e){
substitute(e)
}
t2(substitute(x==y, list(y=y)))[1]
# I would expect all of the following to be equal !?
t2(substitute(x==y, list(y=y)))[1] == substitute(substitute())
t2(substitute(x==y, list(y=y)))[1] == substitute(substitute())[1]
identical(t2(substitute(x==y, list(y=y)))[1], substitute(substitute())[1])
identical(t2(substitute(x==y, list(y=y)))[1], substitute(substitute()))
identical(t2(substitute(x==y, list(y=y)))[1], quote(substitute()))
I have a guess that .Primitive("==") on method dispatch somehow treats its
first argument different from its second. However, if so, is this intended? Or
is it an unavoidable implementation issue? Or a bug?
Best
Jens Oehlschlägel
--
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list