discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Functions literals / higher order functions

RP
Ronaldo Persiano
Tue, Nov 26, 2019 1:20 PM

This is a very suggestive hack: simply add 0 to the result of the function
in move.

function move(a, g) = echo(move=a,g)
function(m)
echo(m_in_move=a,m,g)
assert(m<15)
g(m+a)+0 ;

g1 = function(x) x;
g2 = move(2, g1);
g3 = move(3, g2);
echo(g3_x=g3);
echo(g3_2=g3(2));

I can't remember exactly what but someone reported a similar hack to solve
another trouble.

This is a very suggestive hack: simply add 0 to the result of the function in move. function move(a, g) = echo(move=a,g) function(m) echo(m_in_move=a,m,g) assert(m<15) g(m+a)+0 ; g1 = function(x) x; g2 = move(2, g1); g3 = move(3, g2); echo(g3_x=g3); echo(g3_2=g3(2)); I can't remember exactly what but someone reported a similar hack to solve another trouble.