[Haskell-cafe] A functional programming solution for Mr and Mrs Hollingberry
ok at cs.otago.ac.nz
Wed May 30 00:55:55 CEST 2012
On 30/05/2012, at 10:16 AM, Eric Rasmussen wrote:
> One idea (contrived and silly though it is) is modeling a Courier that delivers message to Persons. There is a standard default reply for all Persons, some individuals have their own default reply, and there are conditional replies based on the sender. Each reply has the ability to alter a Person's mood. The goal of the exercise would be to read in a CSV file in the form of "To, From, Message", and then output the interactions based on rules.
Simulation is of course what Simula 67, the first well known object oriented language,
was devised for. Simula 67 was also one of the first three languages I know of to
include concurrency as a standard feature, the others being PL/I and Algol 68. And
to an Erlang programmer, the obvious way to model a simulation is with one process
per entity. It's also not accidental that Smalltalk has had concurrency since it
first appeared, and the simulation example in the Blue Book (and the simulation
library derived form it) makes essential use of concurrency.
In ML I would use the Concurrent ML facilities (supported in SML/NJ and MLton).
Using Haskell I would definitely consider simulation using concurrency.
And objects per se might not be all that useful. In F# I would expect to use
threads but not classes.
More information about the Haskell-Cafe