2010/1/29 Michael Wood <esiot...@gmail.com>: >> (doseq [d data-seq] >> (.submit clojure.lang.Agent/pooledExecutor (cast Callable #(foo d)))) > > What's the purpose of the cast here? > > #(...) is an fn, which is Callable by definition, isn't it? So > wouldn't that line be equivalent to: > (.submit clojure.lang.Agent/pooledExecutor #(foo d)))
Yes and no... submit is overloaded on Callable and Runnable and #(foo d) implements both. user=> (.submit clojure.lang.Agent/pooledExecutor #(inc 1)) java.lang.IllegalArgumentException: More than one matching method found: submit The cast was just a quick hack to make the example work. -- 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