Damn it, you're right. :-)
(try
(async/>!! cf 1)
(catch Throwable e
(println "caught exception")))
catches it.
On Wed, Jan 22, 2014 at 12:30 PM, Jozef Wagner wrote:
> no, in the same thread. your code is wrong, assert never throws an
> exception.
>
>
> On Wed, Jan 22, 2014 at 9
no, in the same thread. your code is wrong, assert never throws an
exception.
On Wed, Jan 22, 2014 at 9:17 PM, t x wrote:
> Jozef:
>
> (let []
>
> (def c (async/chan 10))
>
> (def cf (async/filter> #(if (even? %) %
> (assert false))
> c
Jozef:
(let []
(def c (async/chan 10))
(def cf (async/filter> #(if (even? %) %
(assert false))
c))
(async/>!! cf 2)
(try
(async/>!! cf 1)
(catch Exception e
(println "caught exception")))
)
I believe filter> caus
use filter>
user=> (def c (chan 10))
#'user/c
user=> (def cf (filter> #(if (even? %) % (throw
(IllegalArgumentException.))) c))
#'user/cf
user=> (>!! cf 2)
nil
user=> (>!! cf 1)
IllegalArgumentException user/fn--4294
(form-init9067455327434905636.clj:1)
user=> (>!! cf 4)
nil
user=> ( ( wrote:
>
With apologies for spamming:
in case anyone else wanted a solution to this problem:
I believe the right layer is to wrap at the Channel layer, rather than the
Buffer layer: for example:
(ns test
(:require
#+clj [clojure.core.async.impl.protocols :as impl]
#+cljs [cljs.core.async.impl.pr
Consider the following attempt:
for some reason, after the assertion fails, the main repl thread seems to
lock up
Line 1
Line 2 // after this, no more is printed
Question: what is causing the problem -- and how do I fix it?
Thanks!
=== code ===
(ns test
(:require
#+clj [clojure.core.as
Can't you just test the value before placing a value in a channel? 22.01.2014, 16:27, "t x" :Hi,## Question: For a channel, is it possible to put a pre-condition of sorts on a channel? For example: (let [chan (async/chan 100)] (set-pre-condition! chan even?) (put! chan 1) ;; exception thr