June 7th, 2009

with Cat The Cat

Actors with multiheaded clauses.

Actors with Multi-Headed Receive Clauses, статья.



Цитата:

Here's a simple example of a market-place actor
receive
  Seller x, Buyer x -> "match found"
We employ the combination of multiple messages in a receive pattern and non-linear patterns to test for a matching seller and a buyer. Non-linear patterns are in fact a short-hand for guards. That is, the above is equivalent to
receive
  Seller x, Buyer y when x == y -> "match found"
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/actor - код на Хаскеле.

Чем это дело интересно? Collapse )