[OpenSCAD] Functions literals / higher order functions

adrianv avm4 at cornell.edu
Sun Nov 3 16:40:53 EST 2019


I wanted to clarify something.  What if I want to write some code to operate
on functions, so

function foo(func) = ....;

If I want to pass an existing function like sin or cos, or maybe a function,
myfunc, that I defined, do I have to go through the whole syntax of 

foo(function(x) sin(x)) 

or

foo(function(x,y) myfunc(x,y))

in order to do this?   Or if I want to define a function variable to equal
an existing function, similarly do I need to use the full syntax:

func_var = function(x) sin(x);

when the right hand side refers to a function that already exists?  






--
Sent from: http://forum.openscad.org/



More information about the Discuss mailing list