Re: Callbacks as Sequences

2013-02-07 Thread JvJ
Thanks, but I'm looking for something that would let me sent strings between programs on localhost. On Wednesday, 6 February 2013 22:17:02 UTC-5, Feng Shen wrote: I did something for a http lib: ;; get them concurrently(let [response1 (http/get http://http-kit.org/;) response2

Re: Callbacks as Sequences

2013-02-07 Thread Erik Bakstad
Not sure it applies, but I found this very interesting: http://oobaloo.co.uk/clojure-from-callbacks-to-sequences Erik kl. 19:45:36 UTC+1 onsdag 6. februar 2013 skrev da...@dsargeant.com følgende: I'm not to clojure/clojurescript and was wondering if anyone has taken a crack at writing

Callbacks as Sequences

2013-02-06 Thread david
I'm not to clojure/clojurescript and was wondering if anyone has taken a crack at writing a macro that transforms callbacks into a sequence. There is an awesome implementationion in LispyScript show here: https://gist.github.com/santoshrajan/3715526. Thanks for help. David -- -- You

Re: Callbacks as Sequences

2013-02-06 Thread Max Penet
Hi, jayq includes something similar (nicer imho). It takes the form of a let like construct (let-deferred [a (jq/ajax http://localhost:8000/1.json;) b (jq/ajax http://localhost:8000/2.json;)] (do-something-with-result (merge a b foo))) It also supports :let and :when intermediary

Re: Callbacks as Sequences

2013-02-06 Thread david
I've seen that and think it's awesome. This would be used for Node.js. I whipped this up to show what a Clojure version might look like. Basically each body form after the first is inserted where (cb) is found in the previous form. ; Definition (defmacro defseq [fn-name params body]) ;

Re: Callbacks as Sequences

2013-02-06 Thread Feng Shen
I did something for a http lib: ;; get them concurrently(let [response1 (http/get http://http-kit.org/;) response2 (http/get http://clojure.org/;)] ;; handle responses one-by-one, waiting for response as necessary ;; other keys :headers :status :error :opts (println response1: (:body