I have a problem with ClojureScript Core-Async. This only happens in ClojureScript, not 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 called, the (foo :ok)result will be as expected - the function ccis called twice, and the console displays cc: :ok cc: :ok after and. But at startup, the (foo 1)function ccalso runs twice, and the console shows cc: 1 cc: :ok. So, although the first condition is not filled, the second is still verified!
Asher source
share