This brings to mind google's warning re: the use of functional idioms in Java:
<a href="http://code.google.com/p/guava-libraries/wiki/FunctionalExplained" rel="nofollow">http://code.google.com/p/guava-libraries/wiki/FunctionalExpl...</a> Objective-C blocks make things smoother than Java, but it still feels to me like the language <i>wants</i> you to have a bunch of small objects sending message to each other. (rather than doing function composition)<p>That said, I use underscore.js in nearly all of my browser and node.js code, so I'll certainly consider this when the iPhone train comes back around.
There are also ports of <i>Underscore.js</i> to Perl & Lua:<p>* <a href="http://vti.github.com/underscore-perl/" rel="nofollow">http://vti.github.com/underscore-perl/</a><p>* <a href="http://mirven.github.com/underscore.lua/" rel="nofollow">http://mirven.github.com/underscore.lua/</a>
Interesting if you're already used to underscore.js.<p>The more Objective-C way to do this, without the dot syntax and the need for wrapping, is to add categories (sets of extra methods) to the NSArray and NSDictionary classes.<p>The square brackets don't impair chaining in any way - you can still [[[myDict allKeys] filter:filterMethod] invoke: invokeMethod]
What's the advantage of implementing map/filter as property accessors of a wrapper object instead of just doing:<p><pre><code> NSArray* map(id<NSFastEnumeration> enumerable, id(^)(id object) block);
</code></pre>
?<p>Obviously, you'd still want to have a prefix of some sort for namespacing.
It's cool that we have an Underscore for Obj-C now, but I'm really excited about this because of the project's opinion that bracket syntax sucks.<p>It's always been a curiosity that a company like Apple, who prides themselves on making great user interfaces can't even get it together to make a programming language that's nice to look at. They seem to care about everyone BUT their own kind these days...