Created
February 11, 2015 13:44
-
-
Save rogeralsing/24b1fe479591965e5aea to your computer and use it in GitHub Desktop.
looped state
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
open Akka.FSharp | |
open Akka | |
open Akka.Configuration | |
let system = System.create "my-system" (Configuration.defaultConfig()) | |
let aref = | |
spawn system "my-actor" | |
(fun mailbox -> | |
let rec loop(state) = actor { | |
let! message = mailbox.Receive() | |
printfn "%s %A" message state | |
return! loop(state+1) | |
} | |
loop(0)) | |
aref <! "hello" | |
aref <! "We" | |
aref <! "Use" | |
aref <! "Looped state" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This outputs
Where the number is state that is passed around in the loop.