Re:The reason why Blub programmers have such a hard time pic...
by mynameishere on Sunday September 30, 2007 @12:05AM
(#61221)
dest = map(square, src)
Well, this is okay. Of course, in java, you have to hack it unpleasantly,
List dest = map(UtilityMethods.class, "square", src)
...you have to manually extract the method "square" from UtilityMethods.class and process it over src. One advantage: You can use UtilityMethods as a namespace and swap in different methods thereby.
dest = mapsquare(src)
Consider the possibility that C-like syntax and mixedCaseVerboseNames may be an acquired taste.
If you do square a lot other things than lists, it's probably best to say
dest = map(square, src)
For one-shot usage where defining square seems overkill, and where it's available and idiomatic, I find the list comprehension most readable.