From: Caleb Clausen Date: 2010-04-04T12:26:42+09:00 Subject: Re: combined ranges... On 4/3/10, Colin Bartlett wrote: > So, temporarily ignoring the problem of possible infinite loops > (which I'd just begun to worry about - I was using a = [2] ; a << a, > which in IRB gives [2, [...]], and a = a[1] #=> [2, [...]], > but your example is even simpler) > you opted for recursive_each (and recursive_reverse_each)? Actually, while interesting, recursive_each and friends are not really relevant to what that file is doing. I really should have put in a little more info about what my code is doing, sorry. The main interface is Ron::GraphEdge.graphwalk(), which walks all the edges (not just nodes) of an object graph. A node might be visited more than once if there are multiple edges leading to it. I'm doing some other things there which are beyond the scope of what others in this thread have attempted (or needed), such as iterating over the subfields of an Object. There's also code in there for copying, not just walking an object graph, potentially changing it while it is copied. > Going back to the original problem, my understanding is that > Roger Pack was looking for a simple way of putting some > data into an array and then getting at it, in which case > the likely maximum depth may well be known, and then > Robert Klemme's solution with a mandatory level/depth argument > seems to work. Yeah, we (especially me) have rather gotten off topic of what Roger wanted. I'm sure my code is not helpful to Roger, but I couldn't help sharing it.