[OpenSCAD] Functions literals / higher order functions
rcmpersiano at gmail.com
Mon Nov 25 21:08:51 EST 2019
You may need another coffee after confirming that the following runs
function move(a, g) =
function(x) g(x+a) ;
g1 = function(x) x;
g2 = move(0,g1);
//g0 = g2;
g0 = function(x) g2(x) ;
g3 = move(0,g0);
unless the commented line substitute the g0 definition.
Compiling design (CSG Tree generation)...
ECHO: g3_x = function(x) g((x + a))
ECHO: g3_2 = 2
Compiling design (CSG Products generation)...
Geometries in cache: 5
Geometry cache size in bytes: 1774120
CGAL Polyhedrons in cache: 0
CGAL cache size in bytes: 0
Compiling design (CSG Products normalization)...
Normalized CSG tree has 0 elements
Compile and preview finished.
Total rendering time: 0 hours, 0 minutes, 0 seconds
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Discuss