【发布时间】:2018-10-29 18:43:24
【问题描述】:
我正在尝试从 clojuredocs.org 了解此功能:
;; Create a word frequency map out of a large string s.
;; `s` is a long string containing a lot of words :)
(reduce #(assoc %1 %2 (inc (%1 %2 0)))
{}
(re-seq #"\w+" s))
; (This can also be done using the `frequencies` function.)
我不明白这部分:(inc (%1 %2 0))
【问题讨论】:
标签: clojure