Hi all, Does anyone have a comprehensive list of recursive-type objects in R? is.recursive defines them as by exclusion: "most types of objects are regarded as recursive, except for vector types, ?NULL? and symbols (as given by ?as.name?)." I think this that means recursive objects are: * lists * pairlists * calls * expressions Did I miss anything? Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/
On Wed, May 4, 2011 at 3:26 PM, Hadley Wickham <hadley at rice.edu> wrote:> Hi all, > > Does anyone have a comprehensive list of recursive-type objects in R? > is.recursive defines them as by exclusion: "most types of objects are > regarded as recursive, except for ?vector types, ?NULL? and symbols > (as given by ?as.name?)." ?I think this that means recursive objects > are: > > ?* lists > ?* pairlists > ?* calls > ?* expressionsis.recursive(environment()) # [1] TRUE> > Did I miss anything? > > Hadley > > -- > Assistant Professor / Dobelman Family Junior Chair > Department of Statistics / Rice University > http://had.co.nz/ > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >
On May 4, 2011, at 14:35 , Kenn Konstabel wrote:> On Wed, May 4, 2011 at 3:26 PM, Hadley Wickham <hadley at rice.edu> wrote: >> Hi all, >> >> Does anyone have a comprehensive list of recursive-type objects in R? >> is.recursive defines them as by exclusion: "most types of objects are >> regarded as recursive, except for vector types, ?NULL? and symbols >> (as given by ?as.name?)." I think this that means recursive objects >> are: >> >> * lists >> * pairlists >> * calls >> * expressions > > is.recursive(environment()) > # [1] TRUEClosures:> is.recursive(ls)[1] TRUE> >> >> Did I miss anything? >> >> Hadley >> >> -- >> Assistant Professor / Dobelman Family Junior Chair >> Department of Statistics / Rice University >> http://had.co.nz/ >> >> ______________________________________________ >> R-devel at r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel >> > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel-- Peter Dalgaard Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
Thanks to you both for reminding me about those important recursive objects! Hadley On Wed, May 4, 2011 at 7:49 AM, peter dalgaard <PDalgd at gmail.com> wrote:> > On May 4, 2011, at 14:35 , Kenn Konstabel wrote: > >> On Wed, May 4, 2011 at 3:26 PM, Hadley Wickham <hadley at rice.edu> wrote: >>> Hi all, >>> >>> Does anyone have a comprehensive list of recursive-type objects in R? >>> is.recursive defines them as by exclusion: "most types of objects are >>> regarded as recursive, except for ?vector types, ?NULL? and symbols >>> (as given by ?as.name?)." ?I think this that means recursive objects >>> are: >>> >>> ?* lists >>> ?* pairlists >>> ?* calls >>> ?* expressions >> >> is.recursive(environment()) >> # [1] TRUE > > > Closures: > >> is.recursive(ls) > [1] TRUE > > >> >>> >>> Did I miss anything? >>> >>> Hadley >>> >>> -- >>> Assistant Professor / Dobelman Family Junior Chair >>> Department of Statistics / Rice University >>> http://had.co.nz/ >>> >>> ______________________________________________ >>> R-devel at r-project.org mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-devel >>> >> >> ______________________________________________ >> R-devel at r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel > > -- > Peter Dalgaard > Center for Statistics, Copenhagen Business School > Solbjerg Plads 3, 2000 Frederiksberg, Denmark > Phone: (+45)38153501 > Email: pd.mes at cbs.dk ?Priv: PDalgd at gmail.com > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/
I never use is.recursive/is.atomic because the definition they use for an object to be recursive doesn't usually coincide with what I am interested in. (If you want to know what that definition is you can look at the source code, coerce.c:1790.) In computing on the language I would want one notion where pretty much only calls are recursive in the sense of having componets that need to be recursed into (you can see how that is handled in the byte code compiler which is in the sources as a noweb file). At the internal level, for example in the GC, _every_ object is recursive in the sence of needing to be checked for pointers to other objects, because of the attribute field. There have been discussions of this previeously -- you might search the archive. Best, luke On Wed, 4 May 2011, Hadley Wickham wrote:> Hi all, > > Does anyone have a comprehensive list of recursive-type objects in R? > is.recursive defines them as by exclusion: "most types of objects are > regarded as recursive, except for vector types, ?NULL? and symbols > (as given by ?as.name?)." I think this that means recursive objects > are: > > * lists > * pairlists > * calls > * expressions > > Did I miss anything? > > Hadley > >-- Luke Tierney Statistics and Actuarial Science Ralph E. Wareham Professor of Mathematical Sciences University of Iowa Phone: 319-335-3386 Department of Statistics and Fax: 319-335-3017 Actuarial Science 241 Schaeffer Hall email: luke at stat.uiowa.edu Iowa City, IA 52242 WWW: http://www.stat.uiowa.edu