线程池实现在core.async Clojure的库使用尺寸=芯*2 + 42#的FixedThreadPoolExecutor.
(defonce the-executor
(Executors/newFixedThreadPool
(-> (Runtime/getRuntime)
(.availableProcessors)
(* 2)
(+ 42))
(conc/counted-thread-factory "async-dispatch-%d" true)))
Run Code Online (Sandbox Code Playgroud)
是否有理由使用这些数字(核心数乘以2加42)?这对所有设备都是最佳的吗?我只是想知道丰富的hickey(和贡献者)如何用这些数字来解决.
谢谢nullptr.
以下是对有兴趣的人的讨论:http://clojure-log.n01se.net/date/2013-08-29.html#15 : 45a
如何使用Jsoup从以下html代码中获取"this text"?
<h2 class="link title"><a href="myhref.html">this text<img width=10
height=10 src="img.jpg" /><span class="blah">
<span>Other texts</span><span class="sometime">00:00</span></span>
</a></h2>
Run Code Online (Sandbox Code Playgroud)
当我尝试
String s = document.select("h2.title").select("a[href]").first().text();
Run Code Online (Sandbox Code Playgroud)
它返回
本文其他文本00:00
我试着在Jsoup中读取Selector的api 但是想不通多了.
另外我如何获得类的元素class="link title blah"(多个类?).原谅我,我只知道Jsoup和CSS.
为什么clojure允许使用lessthan(<)或大于(>)运算符/函数的单个参数?我想知道为什么它只是返回'true'而不是强迫至少2个参数?
资源:
(defn >
"Returns non-nil if nums are in monotonically decreasing order,
otherwise false."
{:inline (fn [x y] `(. clojure.lang.Numbers (gt ~x ~y)))
:inline-arities #{2}
:added "1.0"}
([x] true)
([x y] (. clojure.lang.Numbers (gt x y)))
([x y & more]
(if (> x y)
(if (next more)
(recur y (first more) (next more))
(> y (first more)))
false)))
Run Code Online (Sandbox Code Playgroud)