From berwin at maths.uwa.edu.au  Mon Feb 23 04:34:22 2009
From: berwin at maths.uwa.edu.au (Berwin A Turlach)
Date: Mon, 23 Feb 2009 11:34:22 +0800
Subject: [Rd] [R] Semantics of sequences in R
In-Reply-To: <8b356f880902221350q4a976bfr19b0d5b01a989250@mail.gmail.com>
References: <8b356f880902221242r47cdb138w9b1ac05cc5e5e317@mail.gmail.com>
	<49A1BFC7.9060503@stats.uwo.ca>
	<8b356f880902221350q4a976bfr19b0d5b01a989250@mail.gmail.com>
Message-ID: <20090223113422.76cc1494@absentia>

G'day Stavros,

On Sun, 22 Feb 2009 16:50:13 -0500
Stavros Macrakis <macrakis at alum.mit.edu> wrote:

> On Sun, Feb 22, 2009 at 4:12 PM, Duncan Murdoch
> <murdoch at stats.uwo.ca> wrote:

[....]

> > Which ones in particular should change?  What should they change
> > to? What will break when you do that?
> 
> In many cases, the orthogonal design is pretty straightforward.  And
> in the cases where the operation is currently an error (e.g.
> sort(list(...))), I'd hope that wouldn't break existing code. [...]

This could actually be an example that would break a lot of existing
code.

sort is a generic function, and for sort(list(...)) to work, it would
have to dispatch to a function called sort.list; and as Patrick Burns'
"The R Inferno" points out, such a function exists already and it is not
for sorting list.  

In fact, currently you get:

R> cc <- list(a=runif(4), b=rnorm(6))
R> sort(cc)
Error in sort.list(cc) : 'x' must be atomic for 'sort.list'
Have you called 'sort' on a list?

Thus, to make sort(list()) work, you would have to rename the existing
sort.list and then change every call to that function to the new name.
I guess this might break quite a few packages on CRAN.

Cheers,
	
	Berwin

=========================== Full address =============================
Berwin A Turlach                            Tel.: +65 6516 4416 (secr)
Dept of Statistics and Applied Probability        +65 6516 6650 (self)
Faculty of Science                          FAX : +65 6872 3919       
National University of Singapore     
6 Science Drive 2, Blk S16, Level 7          e-mail: statba at nus.edu.sg
Singapore 117546                    http://www.stat.nus.edu.sg/~statba



[Rd] [R] Semantics of sequences in R
Berwin A Turlach