Sjoerd Visscher's weblog
My ideas about new web technology that can change the future of the world wide web.
< Monday, November 25, 2002 >
FP with Loell
I've updated Loell to better support functional programming. In Javascript you can do functional programming, but you cannot do it in an object oriented way. You can hardly ever use a method, because for this
to have a value, the method has to be a property of an object. In Loell, a method call looks like this:
expr method expr
The value of the left-hand expression is assigned to this
and the value of the right-hand expression is assigned to that
. So 1 {this+that} 2
evaluates to 3. On the Loell page I've added an example that implements lists and adds foldr and foldl, in a proper object oriented way (I think).