Guest User

Untitled

a guest
Apr 24th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. import scala.actors.Actor._
  2. import au.com.langdale.actors.Joins._
  3.  
  4. val a = actor {
  5. loop {
  6. pattern {
  7. case meat @ ("pork" | "chicken") => join {
  8. case "tofu" => join {
  9. case "noodles" => action { println(meat + " pad thai") }
  10. case "broth" => action { println(meat + " laksa") }
  11. }
  12. case "chillis" => join {
  13. case "coconut" => action { println(meat + " green curry") }
  14. case "lettuce" => action { println(meat + " thai salad") }
  15. }
  16. }
  17. case "chillis" => join {
  18. case "coconut" => join { case "beef" => action { println("red beef curry") }}
  19. }
  20. }
  21. }
  22. }
  23.  
  24. "chillis" :: "pork" :: "chillis" :: "coconut" :: Nil foreach { a ! _ }
Add Comment
Please, Sign In to add comment