I have a problem with ClojureScript Core-Async . This only happens in ClojureScript and not in Clojure.
I have the following code:
(defn cc [x]
(go
(println "cc: " x)
x))
(defn foo [x]
(go
(when (and (= :ok (<! (cc x)))
(= :ok (<! (cc :ok))))
(print "after and"))))
(foo 1)
(foo :ok)
When calling (foo :ok)
, the result is as expected - the function cc
is called twice, and the console shows cc: :ok cc: :ok after and
.
But, when running (foo 1)
, the function cc
is also run twice and the console shows cc: 1 cc: :ok
. So, even though the first condition isn't fullfilled, the second one is still checked!