Skip to content

Instantly share code, notes, and snippets.

@mesagie
Created March 15, 2013 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mesagie/5169230 to your computer and use it in GitHub Desktop.
Save mesagie/5169230 to your computer and use it in GitHub Desktop.
Collection can be applied as functions in Scala
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