Martin Percossi wrote: > skaller wrote: > >>> What's point-free style? >>> >>> > > Point-free style (sometimes called pointless style) is where you remove > or factor out free variables from functions. Example (in haskell notation): > > 1) > myAdd x y = x + y > myAddPointFree = (+) >
felix can also do this, but it's a bit ugly, due to the whole overloading/polymorphism trade off: #import <flx.flxh> val myAddPointFree = add of (int*int); print$ myAddPointFree (5, 6); endl; First off, all the operators have real names, so "+" sugars to the "add" function. Second, felix implements overloading by only overloading on the first argument to a curried function. This is why our add functions take a tuple as the first argument, instead of the curried "int -> int -> int" form in most functional languages. Since felix can't currently take the value of an overloaded function (for example: "val f = add"), you need to select which overload you want to use (the "of (int*int)"). On a side note, John, how impossible would it be to have these first-class overloaded functions? > 2) > myAdd3 x = x + 3 > myAdd3PointFree = (+ 3) > That you'd have to curry them yourself: fun addi (x:int) (y:int) => x + y; val myAdd3PointFree = (addi 3); ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Felix-language mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/felix-language
