Skip to content

Instantly share code, notes, and snippets.

@machisuji
Created November 14, 2011 08:54
Show Gist options
  • Select an option

  • Save machisuji/1363559 to your computer and use it in GitHub Desktop.

Select an option

Save machisuji/1363559 to your computer and use it in GitHub Desktop.
object Hello extends App {
val echo = new Echo with TcpConnection {
val host = args.drop(1).headOption getOrElse "localhost"
val port = args.drop(2).headOption.map(_.toInt) getOrElse 80
}
val msg = args.headOption getOrElse "Hallo Welt!"
Client.run(echo) { echo =>
val (text, letters) = echo.echo(msg)
println("\"%s\" contains %d letters.".format(text, letters))
}
}
@mkilling
Copy link

Ich wusste garnicht, dass Scala so schön sein kann :P

@machisuji
Copy link
Author

Ich wusste garnicht, dass Scala nicht so schön sein kann. ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment