i) (function(x, ...) length(...))(1)
gives 0 in S (plus 3.4) and an error in R.
It also gives an error in Splus 5.0r3.
So we could well remain as we are... however
ii) (function(x, ...) length(...))(1,2)
gives 1 in all dialects of S that I have available.
So by my `continuation logic', I'd argue that "i)" above
should give 0
(and R and S-plus 5.0r3 behave inconsistently.
Do we yet have any documentation on "..." ??
In both Splus 3.4 and 5.0r3,
(function(x, ...) mode(...))(1) returns "missing"
whereas R gives an interesting error:
R> trace(mode)
R> (function(x, ...) mode(...))(1)
trace: mode(...)
Error: Argument "x" is missing, with no default
---
What is desired for R?
BTW: Found the above problem when trying to use
C(<factor>) without a 2nd argument; a patch for that will be in
the
snapshots..
Martin Maechler <maechler@stat.math.ethz.ch>
http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum SOL G1; Sonneggstr.33
ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND
phone: x-41-1-632-3408 fax: ...-1086 <><
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Peter Dalgaard BSA
1999-Jun-26 14:53 UTC
What is "..." when it's empty? -- differences to S
Martin Maechler <maechler@stat.math.ethz.ch> writes:> i) (function(x, ...) length(...))(1) > > gives 0 in S (plus 3.4) and an error in R. > It also gives an error in Splus 5.0r3. > So we could well remain as we are... however > > ii) (function(x, ...) length(...))(1,2) > > gives 1 in all dialects of S that I have available. > So by my `continuation logic', I'd argue that "i)" above should give 0 > (and R and S-plus 5.0r3 behave inconsistently. > > Do we yet have any documentation on "..." ?? > > In both Splus 3.4 and 5.0r3, > (function(x, ...) mode(...))(1) returns "missing" > whereas R gives an interesting error: > R> trace(mode) > R> (function(x, ...) mode(...))(1) > trace: mode(...) > Error: Argument "x" is missing, with no default > > --- > What is desired for R?I don't have S-plus 5.0r3 around, but the two others are consistent with the result of length(), resp. mode() (with no arguments), both of which have minor R/S incompatiblities. I see nothing wrong with "...", but we might consider modifying length() and mode(), both of which look like one-line if(is.missing(.... changes. -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel 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-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Prof Brian D Ripley
1999-Jun-27 07:39 UTC
What is "..." when it's empty? -- differences to S
On Sat, 26 Jun 1999, Martin Maechler wrote:> i) (function(x, ...) length(...))(1) > > gives 0 in S (plus 3.4) and an error in R. > It also gives an error in Splus 5.0r3. > So we could well remain as we are... however > > ii) (function(x, ...) length(...))(1,2) > > gives 1 in all dialects of S that I have available. > So by my `continuation logic', I'd argue that "i)" above should give 0 > (and R and S-plus 5.0r3 behave inconsistently.Try iii) (function(x, ...) length(...))(1,2,3) to see that the continuation logic is false. I think function(x, ...) length(list(...)) is what one wants here, and they (R, 3.4, 5.1) are all consistent on that. (I see that is what you put in C.)> Do we yet have any documentation on "..." ?? > > In both Splus 3.4 and 5.0r3, > (function(x, ...) mode(...))(1) returns "missing" > whereas R gives an interesting error: > R> trace(mode) > R> (function(x, ...) mode(...))(1) > trace: mode(...) > Error: Argument "x" is missing, with no default > > --- > What is desired for R?I would leave these: none of them seem sensible uses of ... to me. BTW, NEWS says o C() didn't works (again?) for a single argument which apart from grammar seems not entirely precise. It looks to me that it failed if how.many _and_ ... were missing, and that was broken only once, in revision 1.2.2.1 date: 1999/05/05 01:25:24; author: ripley; state: Exp; lines: +4 -3 Add ... args to pass to contr.treatment etc Also, I do not really like `didn't work': can we try to distinguish between `failed' (gave an error) and `gave incorrect results'? Reason: the second is much more serious. Brian -- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel 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-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._