Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import scala.actors.Actor._
- import au.com.langdale.actors.Joins._
- val a = actor {
- loop {
- pattern {
- case meat @ ("pork" | "chicken") => join {
- case "tofu" => join {
- case "noodles" => action { println(meat + " pad thai") }
- case "broth" => action { println(meat + " laksa") }
- }
- case "chillis" => join {
- case "coconut" => action { println(meat + " green curry") }
- case "lettuce" => action { println(meat + " thai salad") }
- }
- }
- case "chillis" => join {
- case "coconut" => join { case "beef" => action { println("red beef curry") }}
- }
- }
- }
- }
- "chillis" :: "pork" :: "chillis" :: "coconut" :: Nil foreach { a ! _ }
Add Comment
Please, Sign In to add comment