what you want is just a stream in each direction.

Bob:  So, how do you feel about the Smith contract?
Fred: It's not a good deal for us

Fred: Do you think we'll have 4 engineers working on it?
Bob: Turn left here
Bob: No, more like 5

Fred: at the light?
Bob: Yes

I'd make a wrapper around a socket connection. If you want an async
call,
like Fred's last question "at the light?"  then have a different send
access that takes two args,
(ask-bob  "at the light?"   (fn [response]  ... handle the
response....))

as opposed to
(tell-bob  "blah blah")
that doesn't get a response
(after all, you presumably need to know what question Bob is answering
'yes' to)

ask-bob sends bob an id along with the question, and shoves the
function into a map with id as key
when bob sends a response the function gets called

The recieving end is a good candidate for a multimethod.
the dispatch function would somehow parse the message for type
 and figure out which handler handles it.

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to