F# Agents

I'm still working out the basics of these things, but I think the MailboxProcessor or agent based programming in F# is fairly interesting.

In the snippet below, I'm creating an agent named agent, which handles two types of messages. Playing around with this has shown me a couple of things.

Here is a snippet of the code:

In fsi, this outputs something like the following:

a
b
c
d
reading: (1, 5)
Got 1 to 5 of 9064
-> id: 4127627445
-> id: 4127627086
-> id: 4127626626
-> id: 4127609695
-> id: 4127594821
printing: omfg
reading: (47, 2)
Got 47 to 48 of 9064
-> id: 3999958028
-> id: 3999955114