Scala should have a shot at this classic nerd fight.
Concise version:
(1 to 5).map("*"*).foreach(println)Uses language features:
- Implicit conversion to wrap values with decorator classes. (These add the toand*functions to the1and"*"literals respectively.)
- Placeholder parameters allowing partial application of functions passed as arguments.
A desugared version of that line would be:
(1 to 5) map { i => "*" * i } foreach { s => println(s) }Using language features:
- The first feature from the previous snippet.
- Function literals using the =>syntax sugar, which expands toFunction1[-T1, R].
Ruby: