Hi all,
I'm working on a problem that needs an extra set of eyes. I'm getting an
error while trying to write an algorithm that:
1. Over 6400 times, makes a request to an external Java library, for
results
2. Asynchronously listens for those results and ...
3. Maintains a list of filtered results, 10 (or 'n') at a time, while
...
4. Making the next request until the list of 6400 is exhausted
Below is a very simplified outline of how I've set up my code. Before
getting into the nitty gritty, is there something obvious I can do to fix
this code? Is *alter* a blocking call?
;; A. this gets called for each result received from the "request-result"
call.
(defn *result-handler* [options result]
;; process the result
…
;; peel off next request, and send
(let [stock-list *(:remaining options)*]
(dosync (alter stock-list rest))
;; *** ERROR's here*: it peels off the first few items, but later, just
returns back to the original :remaining list
(request-result (first @stock-list))
)
)
;; B. this is where we subscribe to get results
(subscribe-to-results (partial *result-handler* {:a a :b b *:remaining (ref
["orcl", "goog", "msft"])* } ))
;; C. now make request on the first few
(reduce (fn [rlst ech]
…
(request-result ech))
[ "ibm" "aapl" ])
Thanks in advance
Tim Washington
Interruptsoftware.ca
No 6: "I'm not a number. I'M A FREE MAN!!!"
No 2: "HA HA HA HA HAAAAAAA"
-- The Prisoner
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.