Pracuję poprzez radość z clojure i zastanawiam się, co robi składnia _ w wektorze argumentów funkcji.Clojure: Co robi [_] na liście argumentów funkcji?
Przykład:
(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)))))
Co jest podkreślenia robi w formie:
#(dotimes [_ exec-count] (func))
W języku Haskell _ oznacza coś, na co naprawdę nie zależy. Jak złapać wszystko "coś". Rodzaj zmiennej "cokolwiek jest tutaj". Interesuje Cię, czy to jest podobne w clojure ... – Shark