discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

"Unpack" a vector

B
Bananapeel
Thu, Dec 4, 2014 11:23 PM

Is there a way to get the echo I want (see the comment):

function n(c) = [
c,
[for (i=[0:c]) c*i] // different way to write this
];

echo (n(10));
// ECHO: [10, 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]

Best wishes,
Bananapeel :)

--
View this message in context: http://forum.openscad.org/Unpack-a-vector-tp10350.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Is there a way to get the echo I want (see the comment): function n(c) = [ c, [for (i=[0:c]) c*i] // different way to write this ]; echo (n(10)); // ECHO: [10, 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100] Best wishes, Bananapeel :) -- View this message in context: http://forum.openscad.org/Unpack-a-vector-tp10350.html Sent from the OpenSCAD mailing list archive at Nabble.com.
B
Bananapeel
Thu, Dec 4, 2014 11:41 PM

Ok, I got it:

function n(c) = concat([c],
[for (i=[0:c]) c*i]
);

echo (n(10));

--
View this message in context: http://forum.openscad.org/Unpack-a-vector-tp10350p10353.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Ok, I got it: function n(c) = concat([c], [for (i=[0:c]) c*i] ); echo (n(10)); -- View this message in context: http://forum.openscad.org/Unpack-a-vector-tp10350p10353.html Sent from the OpenSCAD mailing list archive at Nabble.com.