[OpenSCAD] Openscad Indirect Functions

nop head nop.head at gmail.com
Tue Oct 18 11:34:46 EDT 2016


There is no need for lambda at all. It is only syntactic sugar and since
nobody can agree on the syntax it is only ever sweet for a subset of
people. It makes the language a bit more complicated but doesn't make it
more powerful or even easier to read. If you are forced to name functions
it makes the code more explicit if good names are chosen.

On 18 October 2016 at 16:21, runsun <runsun at gmail.com> wrote:

> 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.
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss at lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20161018/e15db695/attachment-0002.html>


More information about the Discuss mailing list