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

Re: A tiny producer-consumer framework

2011-01-24 Thread Ken Wesson
On Mon, Jan 24, 2011 at 3:22 AM, Eric Schulte wrote: > Ken Wesson 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 arities. It's >> something like (

Re: A tiny producer-consumer framework

2011-01-24 Thread Eric Schulte
Ken Wesson writes: > On Sat, Jan 22, 2011 at 11:26 AM, Eric Schulte 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. >> >> http://cs.unm.e

Re: A tiny producer-consumer framework

2011-01-22 Thread Ken Wesson
On Sat, Jan 22, 2011 at 11:26 AM, Eric Schulte 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. > > http://cs.unm.edu/~eschulte/research/propagator/

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 writes: > (defmacro consumer [[item] & body]

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