Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type Meal =
- | Breakfast of string
- | Lunch of string
- | Dinner of string
- let interpretMeal meal =
- match meal with
- | Breakfast("Havregroed") -> "EN: Oatmeal is a delicious breakfast"
- | Lunch("Fisk") -> "EN: Fish is a delicious lunch"
- | Lunch("Rugbrød") -> "EN: rye bread is the most popular bread in Denmark"
- | Dinner("Frikadeller") -> "EN: meat balls are a delicious dinner"
- | Dinner("Tarteletter") -> "EN: tartlets is delicious dinner dish"
- | _ -> "Unknown dish"
- // test
- interpretMeal (Breakfast("Havregroed"))
- type Sports =
- |Individual of string
- |Team of string * int
- let interpretSport sport =
- match sport with
- |Team("Ôóòáîë", 11) -> "EN: The Englis sport Football with 11 players "
- |Team("Áàñêåòáîë", 5) ->"EN: American sport Basketball with 5 payers"
- |Team ("Õîêåé",6) -> "EN: Canadian sport Hockey with 6 players"
- |Individual ("Ãîëô") -> "EN: Golf"
- |Individual("Òåíèñ") -> "EN: Tennis"
- |_ -> "Unknown"
- // test
- interpretSport (Individual("Ãîëô"));;
- interpretSport (Team ("Õîêåé",6));;
- let interpretAgentMeal =
- MailboxProcessor.Start(fun inbox->
- let rec msgLoop = async{
- let! meal = inbox.Receive()
- printfn "%s" (interpretMeal meal)
- return! msgLoop
- }
- msgLoop)
- interpretAgentMeal.Post (Breakfast("Havregroed"));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement