Hello Anniepoo, thank you for the answer. I t made me think in new directions, splendid!
Its streams, I completely agree. What I still try is mapping this to the ubiquitous Clojure-sequences. And what I came up with is seeing the stream as blocking lazy sequence of strings (the lines), that can then be transformed into blocking lazy sequence of messages (that may be multiline, I didn't mentioned that before). And now I'm not sure whether the blocking permits to be a sequence. As far as I understand, blocking (in the Clojure world) should be restricted to references. And if head and tail of a "seq" are references, they dont fit the interface anymore, or do they. Still thinking ;-) Kind regards, alux On 14 Apr., 22:41, Anniepoo <annie6...@yahoo.com> wrote: > 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.