Popular recipes by Dominic Fox http://code.activestate.com/recipes/users/1951506/2005-08-19T08:34:06-07:00ActiveState Code RecipesList/Generator Monad Combinators (Python) 2005-08-19T08:34:06-07:00Dominic Foxhttp://code.activestate.com/recipes/users/1951506/http://code.activestate.com/recipes/439361-listgenerator-monad-combinators/ <p style="color: grey"> Python recipe 439361 by <a href="/recipes/users/1951506/">Dominic Fox</a> (<a href="/recipes/tags/algorithms/">algorithms</a>). Revision 2. </p> <p>The List monad in Haskell has many uses, including parsing and nondeterministic algorithms. This code implements the Monad combinators "bind", "return" and "fail", and the MonadPlus combinators "plus" and "zero". It works with all iterables, and returns a generator rather than a list in order to preserve a lazy semantics.</p> Active Objects (Python) 2005-02-03T20:09:13-08:00Dominic Foxhttp://code.activestate.com/recipes/users/1951506/http://code.activestate.com/recipes/365292-active-objects/ <p style="color: grey"> Python recipe 365292 by <a href="/recipes/users/1951506/">Dominic Fox</a> (<a href="/recipes/tags/threads/">threads</a>). Revision 2. </p> <p>Based on the recipe for active objects given in "Concepts, Techniques, and Models of Computer Programming", by Peter van Roy and Seif Haridi, the ActiveObject class wraps an instance of a passive object and forwards messages to this object via a thread-safe message queue. The passive object processes the messages on its own thread, and returns the results to the caller via an AsynchResult object that can be used to block whilst waiting for a result, or to register callbacks to be called when a result is available.</p> Buffered Stream with Multiple Forward-Only Readers (Python) 2005-03-18T07:40:04-08:00Dominic Foxhttp://code.activestate.com/recipes/users/1951506/http://code.activestate.com/recipes/392150-buffered-stream-with-multiple-forward-only-readers/ <p style="color: grey"> Python recipe 392150 by <a href="/recipes/users/1951506/">Dominic Fox</a> (<a href="/recipes/tags/algorithms/">algorithms</a>). </p> <p>This recipe provides a buffered stream that supports multiple forward-only readers. The buffer enables readers that are behind the front-runner to access values that have already been read from the stream. Values that are no longer accessible by any reader are cleared from the buffer.</p> Thread-safe MultiQueue (Python) 2005-02-05T17:13:00-08:00Dominic Foxhttp://code.activestate.com/recipes/users/1951506/http://code.activestate.com/recipes/365640-thread-safe-multiqueue/ <p style="color: grey"> Python recipe 365640 by <a href="/recipes/users/1951506/">Dominic Fox</a> (<a href="/recipes/tags/threads/">threads</a>). Revision 3. </p> <p>A class that contains a dictionary of named queues, with read requests blocking until a message has been added to any one of a supplied list of queues.</p>