I thought this problem (described here http://www.cs.otago.ac.nz/staffpriv/ok/santa/) was nifty back when I first encountered Erlang and as a learning exercise I wanted to model something similar in Clojure. I tried to follow the Erlang solution described in the link (http:// www.cs.otago.ac.nz/staffpriv/ok/santa/santa.erl) as closely as possible. I struggled with 'holding back' the workers the secretaries had accumulated if Santa was busy. I settled on having a Santa's meeting room ref that the secretary checks to see if it is empty and if not waits and tries again. I'm not sure if this is good Clojure style or even a sensible way to go about things (dosync-ing and blocking in an agent action?). Also I've shifted responsibility for admitting the workers from Santa to the secretaries. I couldn't think of another way. Another issue is I have no idea how to prioritise reindeer if elves and reindeer turn up at the same time. Any comments and suggestions welcome!
http://pastebin.com/f57877980 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---