From maechler at stat.math.ethz.ch  Fri Jun  4 11:43:38 2010
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Fri, 4 Jun 2010 11:43:38 +0200
Subject: [Rd] named empty list
In-Reply-To: <4C080FA6.9070400@fhcrc.org>
References: <4C080FA6.9070400@fhcrc.org>
Message-ID: <19464.51914.206199.975249@lynne.math.ethz.ch>

>>>>> "HP" == Herv? Pag?s <hpages at fhcrc.org>
>>>>>     on Thu, 03 Jun 2010 13:25:10 -0700 writes:

    HP> Hi,
    HP> I just realized that a named empty list is displayed the same
    HP> way as an empty list:

    >> list(aa=2:5)[0]
    HP> list()
    >> list()
    HP> list()

    HP> For empty atomic vectors, the print method makes the difference:

    >> c(aa=3L)[0]
    HP> named integer(0)
    >> integer(0)
    HP> integer(0)

    HP> Maybe lists could do that too?

Yes, I agree.  I have had at least one situation in the past
where I had even been confused for a few minutes by this.
I'm about to add it for R-devel [2.12.0] (only; considering it a
new feature).

Martin Maechler, ETH Zurich



[Rd] named empty list
Martin Maechler