Scoped binding of a method to an object

Russell Leggett russell.leggett at gmail.com
Tue Oct 15 11:06:23 PDT 2013


>
>
>> The big issue I see here is chaining.
>>  `_.reduce(_.map(_.filter([1,2,3,4,5],x=>x%2 === 0),x=>2*x),(x,y)=>x+y)`
>> Is a lot less readable than
>>  `[1,2,3,4,5].filter(x=>x%2===0).map(x=>2*x).reduce((x,y)=>x+y))`
>>
>
>
P.S. This really doesn't look too shabby to me:

    import {reduce,map,filter} from "underscore2";
    [1,2,3,4,5]::filter(x=>x%2===0)::map(x=>2*x)::reduce((x,y)=>x+y))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20131015/eb0d42e3/attachment.html>


More information about the es-discuss mailing list