<br><br><div class="gmail_quote">On Tue, Jun 1, 2010 at 22:54, Philippe Sigaud <span dir="ltr"><<a href="mailto:philippe.sigaud@gmail.com">philippe.sigaud@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="gmail_quote">I also found the (simple?) problem to enumerate a range of ranges to be more interesting than I thought.<br><div>
Given a range of ranges ... of ranges, of whatever rank, recursively enumerate it:<br><br>[[a,b,c],[d,e,f],[g,h,i]]<br><br>produce:<br><br>(a,0,0),(b,0,1), (c,0,2),(d,1,0), ...<br><br>the coordinates of each element, if you will. I have a working version now, but it sure taught me that my vision of recursion was flawed.<br>
<br></div></div></blockquote><div><br>Ow, I meant, while conserving the original topology, not as a flat range:<br><br>[[(a,0,0),(b,0,1),(c,0,2)],<br> [(d,1,0), (e,1,1),(f,1,2)],<br> [(g,2,0), (h,2,1),(i,2,2)]]<br><br>Lazily, of course.<br>
I wanted the to conserve the rank because<br><br>1- that was the goal of the module: map, produce, etc range of ranges<br>2- it allowed me to iterate to a 'line' and then descend into this particular line.<br>3- the original idea was to generate an infinite n-dim grid of coordinates<br>
<br>Philippe<br><br></div></div>