Created
July 20, 2012 05:12
-
-
Save rf/3148815 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import scala.actors._ | |
import scala.actors.Actor._ | |
case object Poke | |
case object Idling | |
class Kid () extends Actor { | |
def act () = loop { | |
if (mailboxSize == 0) this ! Idling | |
react { | |
case Poke => println("ow you poked me") | |
case Idling => println("idling lol") | |
} | |
} | |
} | |
var richard = new Kid().start | |
richard ! Poke | |
richard ! Poke | |
// vim: set ts=4 sw=4 et: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment