List comprehensions were added in 2.0, generator comprehensions were added in 2.4, and dictionary comprehensions came in 2.7
:)
http://www.haskell.org/pipermail/haskell-cafe/2010-November/...
(joke)
val allowed_usernames = all_users.filter(_.is_admin()).map(_.username)
or val allowed_usernames = for(user <- all_users if user.is_admin()) { yield user.username }
And still get all the of goodness of Trivial jvm/java compatability... (map :username (filter admin? all-users)) (for [username all-users] :when (admin? username)) all_users.select(_.is_admin).map _.username
Other languages have similar ways to write it concisely as well (http://bit.ly/a6QmgL). Coffeescript (which compiles to javascript, and therefore, can run on Rhinon inside the jvm) in particular: allowed_usernames = user.username for user in all_users when user.is_admin()
Yeah. Reminds me of http://gag.googlecode.com/svn/trunk/javadoc/com/google/gag/a... all_users.select(&:is_admin).map(&:username)
This is a common idiom with a fantastic writeup at http://weblog.raganwald.com/2008/02/1100inject.html deck = ['%s%s' % (n, s) for s in 'HDCS' for n in '23456789XJQKA']
It creates a deck of cards.Also, you can easily shuffle the deck using the standard library.
import random
random.shuffle(deck)As far as "playing catch up with a moving target", I don't see how that's terribly relevant, the end result is still a platform that continues to improve and advance. If the C# code that runs on Windows and mono is still more advanced than, say, Java or Perl, and continues to advance (even though not as fast as C# on Windows alone) then that's still a benefit. Given the advent of monotouch and the coming of monodroid it seems like even a hard-core MS hater could come to appreciate C#.
The problem is that it's not. You can do anything you want when it comes to SaaS using python, ruby, php, node or java. Actually those have huge open source communities with tons of libs available to make work faster. This is not the case of C# and if it ever gets there, it probably won't be any better. So again, I don't see any reason to use it, and plenty of reasons not to and being a "hard-core MS hater" would probably come at the bottom of the list of reasons not to use C#, don't try to justify the lack of interest in MS by some kind of imaginary persecution. But to each his own , if you're happy with it go for it.
Some of them also believe Python, Ruby etc are for kiddies :)