I've compiled and used this for a while without problems, a simple utility
function to drain all the remaining values on a channel:
(defn drain
"Takes all values available on a chan then returns a vector of them, leaving
the channel empty. Compatible with cljs too. Optionally takes a single function
which accepts a single value and will process each drained value with this
function, while also placing original value onto the vector."
[c & f]
(go
(loop [r []]
(alt!
(timeout 700) r
c ([v]
(when f
((first f) v))
(recur (conj r v)))))))
I used this on clojurescript 0.0-2173. When I upgraded to 0.0-2311 I now get
the error: "Can't recur here".
Since the code didn't change, why is recur allowed in one version but not the
other?
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.