Skip to content

Instantly share code, notes, and snippets.

@iboss-ptk
Created September 23, 2015 10:06
Show Gist options
  • Save iboss-ptk/fd0750c66315a72b84e3 to your computer and use it in GitHub Desktop.
Save iboss-ptk/fd0750c66315a72b84e3 to your computer and use it in GitHub Desktop.
Single line Caesar cipher decryption in Scala
println(scala.io.Source.fromFile("assgn.txt").toList.map( x => if( "ABCDEFGHIJKLMNOPQRSTUVWXYZ".toList contains x ) (("ABCDEFGHIJKLMNOPQRSTUVWXYZ".toList zip "GHIDDKLMNOFPMRSCTEUVBWXYYA".toList)(scala.collection.breakOut): Map[Char, Char])(x) else x ).mkString)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment