私はclojureの喜びを味わい、_構文が関数の引数ベクトルで何をするのか疑問に思っています。Clojure:関数の引数リストで[_]は何をしますか?
例:
(def available-processors
(.availableProcessors (Runtime/getRuntime)))
(prn "available processors: " available-processors)
(def pool
(Executors/newFixedThreadPool (+ 2 available-processors)))
(defn dothreads!
[func & {thread-count :threads exec-count :times :or {thread-count 1 exec-count 1}}]
(dotimes [t thread-count]
(.submit pool #(dotimes [_ exec-count] (func)))))
アンダースコアフォームでやっている:それについて
#(dotimes [_ exec-count] (func))
ハスケルでは、_はあなたが本当に気にしないことを示しています。キャッチオール「何か」のように。 「ここにあるもの」変数の並べ替え。クロージャーで似ているかどうか確認してください... – Shark