Created
March 15, 2013 11:28
-
-
Save mesagie/5169230 to your computer and use it in GitHub Desktop.
Collection can be applied as functions in Scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val mirror = (11 to 0 by -1) | |
mirror map "Barack Obama" mkString //amabO kcaraB | |
// equivalent to | |
mirror.map(index => "Barack Obama"(index)) mkString //amabO kcaraB | |
val shuffle = List(7, 4, 10, 2, 3, 6, 5, 9, 8, 1) | |
shuffle map "Barack Obama" mkString // Ocmra kaba |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment