Skip to content

Instantly share code, notes, and snippets.

@liesen
Forked from fredrik/gist:119176
Created May 28, 2009 12:32
Show Gist options
  • Save liesen/119266 to your computer and use it in GitHub Desktop.
Save liesen/119266 to your computer and use it in GitHub Desktop.
// Bush in Scala
package tests
object Bush {
def main(args : Array[String]) : Unit = {
val states = "Alabama\nAlaska\nArizona\nArkansas\nCalifornia\nColorado\nConnecticut\nDelaware\nFlorida\nGeorgia\nHawaii\nIdaho\nIllinois\nIndiana\nIowa\nKansas\nKentucky\nLouisiana\nMaine\nMaryland\nMassachusetts\nMichigan\nMinnesota\nMississippi\nMissouri\nMontana\nNebraska\nNevada\nNew Hampshire\nNew Jersey\nNew Mexico\nNew York\nNorth Carolina\nNorth Dakota\nOhio\nOklahoma\nOregon\nPennsylvania\nRhode Island\nSouth Carolina\nSouth Dakota\nTennessee\nTexas\nUtah\nVermont\nVirginia\nWashington\nWest Virginia\nWisconsin\nWyoming".lines
val georgewbush = Set.empty ++ "georgewbush"
printf("It's sweet home %s!%n", (states find { state => !(state.toLowerCase exists { georgewbush contains _ }) }).get)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment