[OpenSCAD] Openscad Indirect Functions

runsun runsun at gmail.com
Tue Oct 18 11:21:59 EDT 2016


ottojas wrote
> Python likes:
> 
> lambda x: x+2
> 
> For anonymous syntax.
> 
> Lisp likes
> 
>  (lambda (x) (+ arg 2))
> 
> For same operation.  I don't particularly like either construct but
> either could be implemented.
> 
> I have now implemented 
> 
>    @(x:x+2)

Just add javascript's version of lambda, *Arrows*, for the reference. This
is more powerful than Python's, imo:


>    f = x=> x+2
>    f = ()=>{ do something, return something }
>    
>    array.map( x=> x+2 )
>    array.map( (x,i)=> `${i}:${x+2}` )  // for array [5,10], return [
> "0:7","1:12"]
>    array.map( (x,i)=> { do something } )





-----

$  Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), synwrite ( 2 );   $ tips: hash ( 2 ), matrix ( 2 , 3 ), sweep ( 2 , 3 ), var ( 2 ), lerp , animation ( gif , prodVid , animlib ), precision ( 2 ), xl-control , type , rounded polygon , chfont , tailRecur ( 2, 3 ), isosphere ( 2 ), area , vol/center , RGB , CurvedImg , tests ( 2 ); $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf ) 
--
View this message in context: http://forum.openscad.org/Convert-from-object-to-polygon-polyhedron-tp18522p18764.html
Sent from the OpenSCAD mailing list archive at Nabble.com.




More information about the Discuss mailing list