[OpenSCAD] Functions literals / higher order functions

Ronaldo Persiano rcmpersiano at gmail.com
Mon Nov 25 21:58:36 EST 2019


I followed Michael and also dropped the g. But anyway, the last code still
works fine with

function move(a, g) =
  function(x) identity(g(x+a)) ;


Em ter., 26 de nov. de 2019 às 02:23, Ronaldo Persiano <
rcmpersiano at gmail.com> escreveu:

> Inserting an indirection also works fine:
>
>
> function move(a, g) =
>   function(x) identity(x+a) ;
>
> function  identity(x) = x;
>
> g1 = function(x) x;
> g2 = move(0,g1);
> g3 = move(0,g2);
>
> echo(g3_x=g3);
> echo(g3_2=g3(2));
>
>
>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20191126/c7d1adf3/attachment.html>


More information about the Discuss mailing list