On Tue, 20 Feb 2007, Steven Finch wrote:

Hello!

I written several implementations in R of Rémy's algorithm for
generating random ordered strictly binary trees on 2n+1 vertices.

One implementation involves manufacturing character strings like:

"X <- list(0,list(0,0))"

for the case n=2.  If I perform the following two steps:

cmd <- "X <- list(0,list(0,0))"
eval(parse(text=cmd))

then X becomes a true nested list in R.  This works fine for n=2,
but often for n=200, an error message:

Error in parse(text = cmd) : contextstack overflow

appears and execution stops.  Clearly there exists an upper bound
on the allowable depth of nestings in R!  Can this upper bound be
easily increased?

It is hardcoded (as 50) in 6 places in gram.c, so fairly easily changed.

Other implementations avoid this problem, so this issue is not
crucial to me.  I do wish, however, to understand the limits of
this particular approach.  Thank you!

Steve Finch
http://algo.inria.fr/bsolve/

P.S.  If anyone else has written R code for generating random
trees (on a fixed number of vertices), I would enjoy seeing this!

_________________________________________________________________
Don’t miss your chance to WIN 10 hours of private jet travel from Microsoft® Office Live http://clk.atdmt.com/MRT/go/mcrssaub0540002499mrt/direct/01/



--
Brian D. Ripley,                  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595
______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to