Re: [Rd] relist, an inverse operator to unlist

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Wed, 23 May 2007 08:56:50 -0400

On 5/23/07, Seth Falcon <sfalcon_at_fhcrc.org> wrote:
> Andrew Clausen <clausen@econ.upenn.edu> writes:
>
> > Hi Seth,
> >
> > On Mon, May 21, 2007 at 05:15:10PM -0700, Seth Falcon wrote:
> >> I will also add that the notion of a default argument on a generic
> >> function seems a bit odd to me. If an argument is available for
> >> dispatch, I just don't see what sense it makes to have a default. In
> >> those cases, the default should be handled by the method that has a
> >> signature with said argument matching the "missing" class.
> >>
> >> What often does make sense is to define a generic function where some
> >> argument are not available for dispatch. For example:
> >>
> >> setGeneric("foo", signature="flesh",
> >> function(flesh, skeleton=attr(flesh, "skeleton")
> >> standardGeneric("foo")))
> >
> > That's an excellent suggestion. Thanks! However, I had to set the signature
> > to c("numeric", "missing") rather than just "numeric".
> >
> > I have uploaded a new version here:
> >
> >
http://www.econ.upenn.edu/~clausen/computing/relist.R
>
> I misunderstood. You aren't using S4 classes/methods at all
> and so I don't actually see how my comments could have been helpful in
> any way. relist seems like a really odd solution to me, but based on
> the discussion I guess it has its use cases.

You didn't misunderstand but there was an offline discussion pointing out that one primary use is in the inner loop of an optimization so it should be made as efficient as possible and it was changed with that in mind.



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed 23 May 2007 - 12:59:39 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 23 May 2007 - 13:33:35 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.