[OpenSCAD] Functions literals / higher order functions

Ronaldo Persiano rcmpersiano at gmail.com
Tue Nov 26 08:20:53 EST 2019


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20191126/4520affd/attachment.html>


More information about the Discuss mailing list