Errors are most likely occurring on a thread different than main. Assuming 
you're using nrepl, have you looked at the nrepl-error buffer?


On Saturday, December 7, 2013 7:27:35 PM UTC-6, Paul Butcher wrote:
>
> Consider the following function that adds two numbers exceptionally 
> inefficiently by creating lots of threads:
>
> user=> (require '[clojure.core.async :refer [thread <!!]])
> nil
> user=> (defn thread-add [x y]
>   #_=>   (thread
>   #_=>     (if (zero? y)
>   #_=>       x
>   #_=>       (let [t (thread-add (inc x) (dec y))]
>   #_=>         (<!! t)))))
> #'user/thread-add
>
>
> This works for small numbers:
>
> user=> (<!! (thread-add 10 10))
> 20
> user=> (<!! (thread-add 10 1000))
> 1010
>
>
> Unsurprisingly, it fails after a certain point, because the JVM simply 
> can't create enough threads. But what I find surprising is that it fails 
> completely silently - no error message, just a nil return:
>
> user=> (<!! (thread-add 10 2000))
> nil
>
>
> Is this what I should expect? Is there any way to persuade the REPL to 
> show me errors in this kind of situation?
>
> --
> paul.butcher->msgCount++
>
> Silverstone, Brands Hatch, Donington Park...
> Who says I have a one track mind?
>
> http://www.paulbutcher.com/
> LinkedIn: http://www.linkedin.com/in/paulbutcher
> Skype: paulrabutcher
>
>
>
>  
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to