4 ms·
You can do similar in scala, either val allowed_usernames = all_users.filter(_.is_admin()).map(_.username) or val allowed_usernames = for(user <- all_use
by whakojacko 16y ago
You can do similar in scala, either
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...
- moshezadka 16y agoNothing against scala, but you can program in Python and get all the goodness of JVM compat by simply running your programs in Jython...
- lusis 16y agoJython is behind current python implementations. If you're comfortable with being compatible up to python 2.5 then go right ahead. But if you need 2.6 or 2.7 compatibility, Jython is sadly not an option.
- jcromartie 16y agoOr Clojure... (or... or... or...) (map :username (filter admin? all-users))
- Scriptor 16y agoOr Clojure again (for [username all-users] :when (admin? username))