I very much appreciate having functions as first-class values. However,
I'm finding it increasingly annoying that Array.map and .filter don't
follow the normal definitions. I keep writing
a.map( function(l){return ...} );
only to get run-time errors because map requires a function with three
(!) arguments. So I have to change it to:
a.map( function(l,i:int,a:Array){return ...} );
Why do map/filter and some of the other higher-order functions have such
an unconventional semantics? As well as being annoying, passing the
index and complete array also seems to me to violate the normal
encapsulation rules that you'd expect of map.
Is there a 'normal' version of map somewhere that I'm missing?
Thanks,
Ed