Re: A tiny producer-consumer framework

2011-01-24 Thread Eric Schulte
Ken Wesson kwess...@gmail.com writes: On Sat, Jan 22, 2011 at 11:26 AM, Eric Schulte schulte.e...@gmail.com wrote: Nice concise example, Thanks. A while back I implemented something similar; a propagator system using agents fed with `send', coming in at a slightly more verbose ~35 lines

Re: A tiny producer-consumer framework

2011-01-24 Thread Ken Wesson
On Mon, Jan 24, 2011 at 3:22 AM, Eric Schulte schulte.e...@gmail.com wrote: Ken Wesson kwess...@gmail.com writes: Why (fn [_] value) instead of (constantly value)? OK, actually (constantly value) is textually longer, but I'd argue it might be clearer. And it works; (constantly foo) accepts all

Re: A tiny producer-consumer framework

2011-01-24 Thread Eric Schulte
That would be a great application for this system.  Each cell of the spreadsheet could be a cell, and each formula could be a propagator. I've implemented this and it seems to work well, I've committed this to the repo above, and posted the spreadsheet code with example usage into a gist at

A tiny producer-consumer framework

2011-01-22 Thread Ken Wesson
(defmacro consumer [[item] body] `(agent (fn c# [~item] ~@body c#))) (defmacro defconsumer [name item body] `(def ~name (consumer ~item ~@body))) (defn feed [consumer values] (doseq [v values] (send-off consumer apply [v]))) Nine lines of code. user= (defconsumer

Re: A tiny producer-consumer framework

2011-01-22 Thread Eric Schulte
Nice concise example, A while back I implemented something similar; a propagator system using agents fed with `send', coming in at a slightly more verbose ~35 lines of code. http://cs.unm.edu/~eschulte/research/propagator/ Cheers -- Eric Ken Wesson kwess...@gmail.com writes: (defmacro

Re: A tiny producer-consumer framework

2011-01-22 Thread Ken Wesson
On Sat, Jan 22, 2011 at 11:26 AM, Eric Schulte schulte.e...@gmail.com wrote: Nice concise example, Thanks. A while back I implemented something similar; a propagator system using agents fed with `send', coming in at a slightly more verbose ~35 lines of code.