<br><br><div class="gmail_quote">2011/9/8 Mathieu Bouchard <span dir="ltr">&lt;<a href="mailto:matju@artengine.ca">matju@artengine.ca</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div class="im">On Thu, 8 Sep 2011, tim vets wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
what&#39;s the best way to &#39;interlace&#39; two lists, i.e. turn:<br>
1 2 3 4 and 5 6 7 8<br>
into<br>
<a href="tel:1%205%202%206%203%207%204%208" value="+3215263748" target="_blank">1 5 2 6 3 7 4 8</a><br>
?<br>
</blockquote>
<br></div>
It&#39;s usually called interleaving.<br>
<br>
If they are all floats, the fastest is something like this :<br>
<br>
[list prepend 1 4 f #]<br>
 |<br>
[#join 0]---------------[list prepend 1 4 f #]<br>
 |<br>
[#transpose]<br>
 |<br>
[#to_l]<br>
<br>
where the 1 4 f # prefix means you want to make a grid of 1 row and 4 columns of floats. Then in contact with grid-inlets, those prefixed lists become grids of 1 by 4.<br>
<br>
[#join] joins them by the dimension 0, which makes a single grid of (1+1=2) rows by 4 columns.<br>
<br>
[transpose] swaps the first two dimensions, which makes a grid of 4 rows by 2 columns.<br>
<br>
[#to_l] makes a list of 8 elements, row after row.<br>
<br>
Of course you can instead use a [list append] and messagebox containing :<br>
<br>
  $1 $5 $2 $6 $3 $7 $4 $8<br>
<br></blockquote><div>ha good one, I didn&#39;t think of that.<br>In my case the lists are not big but there are many.<br>I may try that solution too, see if it improves speed...<br>thanks,<br>Tim<br><br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


and in that particular case, it&#39;s more efficient, but the GridFlow solution works for any list length, and is probably more efficient for big lists...<br>
<br>
 ______________________________<u></u>______________________________<u></u>___________<br><font color="#888888">
| Mathieu Bouchard ---- tél: <a href="tel:%2B1.514.383.3801" value="+15143833801" target="_blank">+1.514.383.3801</a> ---- Villeray, Montréal, QC</font></blockquote></div><br>