<div dir="ltr">Hi Doug<div><br></div><div>The code is here -  <a href="https://github.com/KitWallace/openscad/blob/master/poly_nets.scad" target="_top" rel="nofollow" link="external">https://github.com/KitWallace/openscad/blob/master/poly_nets.scad</a></div><div><br></div><div>faces are constructed in function rrp (line 234) as a nested list and flattened in fold_render(line 256) using function dflatten() </div><div><br></div><div>The context of the code is described in my blog - basically  it generates nets of solids and folds them</div><div><br></div><div><a href="http://kitwallace.tumblr.com/post/115973599619/polyhedral-nets" target="_top" rel="nofollow" link="external">http://kitwallace.tumblr.com/post/115973599619/polyhedral-nets</a><br></div><div><br></div><div>Chris</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Apr 12, 2015 at 5:26 PM, doug.moen [via OpenSCAD] <span dir="ltr"><<a href="/user/SendEmail.jtp?type=node&node=12352&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>></span> wrote:<br><blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

        Kit, could you show your code that generates the face list?
<br><br>I'd like to see it, because I'm considering an extension to list
<br>comprehensions that would eliminate the need to use 'flatten'
<br>functions for post processing. I'd like to see if my proposed
<br>extension works for your code.
<br><br>Doug Moen
<br><span class=""><br>On 06/04/2015, kitwallace <<a href="http:///user/SendEmail.jtp?type=node&node=12350&i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a>> wrote:
</span><div><span class=""><br>> I'm generating faces as a list of points.  However the list of faces
<br>> comprises a mixture of faces and lists of faces.  I need to flatten this
<br>> mixed list.  So far I'm using
<br>> function depth(a) =   len(a)== undef        ? 0       :
<br>> 1+depth(a[0]);function flatten(l) = [ for (a = l) for (b = a) b ] ;function
<br></span>> dflatten(l,d=2) =// hack to flatten mixed list and list of lists
<br><span class="">> flatten([for (a = l) depth(a) > d ? [for (b=a) b] : [a]]); l= [
<br></span>> [[1,2],[2,3]], [[[1,2],[2,3]]] ];lf = dflatten(l);echo(len(lf),lf);
<br><span class="">> but it doesn't really work generally : d = 1 should yield 4 , not 3  I've
<br>> really struggled to come up with a correct recursive formulation.
<br>>
<br>>
<br>>
<br></span>> --
<br><span class="">> View this message in context:
<br></span>> <a href="http://forum.openscad.org/flattening-mixed-lists-of-lists-tp12316.html" rel="nofollow" link="external" target="_blank">http://forum.openscad.org/flattening-mixed-lists-of-lists-tp12316.html</a><span class=""><br>> Sent from the OpenSCAD mailing list archive at Nabble.com.
</span></div><span class=""><br>_______________________________________________
<br>OpenSCAD mailing list
<br><a href="http:///user/SendEmail.jtp?type=node&node=12350&i=1" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<br><a href="http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org" rel="nofollow" link="external" target="_blank">http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org</a><br>

        
        
        
        <br>
        <br>
        </span><hr noshade size="1" color="#cccccc">
        <div style="color:#444;font:12px tahoma,geneva,helvetica,arial,sans-serif"><span class="">
                <div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
                </span><a href="http://forum.openscad.org/flattening-mixed-lists-of-lists-tp12316p12350.html" target="_blank" rel="nofollow" link="external">http://forum.openscad.org/flattening-mixed-lists-of-lists-tp12316p12350.html</a>
        </div><div class="HOEnZb"><div class="h5">
        <div style="color:#666;font:11px tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
                
                To unsubscribe from flattening mixed lists of lists, <a href="" target="_blank" rel="nofollow" link="external">click here</a>.<br>
                <a href="http://forum.openscad.org/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font:9px serif" target="_blank" link="external">NAML</a>
        </div></div></div></blockquote></div><br></div>


        
        
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://forum.openscad.org/flattening-mixed-lists-of-lists-tp12316p12352.html">Re: flattening mixed lists of lists</a><br/>
Sent from the <a href="http://forum.openscad.org/">OpenSCAD mailing list archive</a> at Nabble.com.<br/>