[Rd] How deep can/should lists be nested?

From: Richard Cotton <richierocks_at_gmail.com>
Date: Sun, 14 Oct 2012 12:06:17 +0100


I started idly wondering how deeply lists could be nested, and couldn't find an explicit limit in the documentation. With this simple test

a_list <- list()
count <- 0
repeat
{
  a_list[[1]] <- a_list
  count <- count + 1
}

my (Win7, R-2.16.0 devel) machine threw an error when count got close to 25000.

The error that stopped it was

Error: protect(): protection stack overflow

I don't know how easy it would be to stop such an error occuring, and it probably isn't that useful to be able to nest lists any further. I do think it might be useful for users to be able to know how deeply they can nest lists though.

Perhaps it would be better to limit nesting to the value of getOption("expressions"). Does anyone have any strong feelings on what the correct behaviour should be?

--
Regards,
Richie

live-analytics.com
4dpiecharts.com

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Sun 14 Oct 2012 - 11:09:45 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

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 Sun 14 Oct 2012 - 12:50:46 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.

list of date sections of archive