Hello,

I want to think loudly today, may be you have suggestions, or the
problemm has been solved already.

I want to do some finite but long two-sided communication, that takes
some time - so like some hundred of strings passing in both
directions. Often alternating, but not always, and not nessesarily so.
In some but not all cases I have a question - response relation (my
side asks the questions, so to say), and there is an easy way to
identify a string as answer to a question, but not everything that
comes back must be a response.

(My current task is to talk to a program, linewise. But maybe the
problem can and should be solved more generally.)

How can I model this in clojure?

My current approach, (pen on paper, still no code):

A question: sends its string, and creates a promise, and puts it in a
map with the question-identifyer as key. The map must be a reference,
because it is changed.

Then there should be a thread, waiting for responses. If a message
arrives, it looks for the identifyer in our map, gets the
corresponding promise from our map, and provides it with the answer.

The client can wait for the answer it expects. How?
What to do with non expected messages?
I still dont know.

Any tips or constructive criticism welcome. Thank you for reading.

Regards, alux

-- 
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