src/word_count.clj

1
2
3
4
5
6
7
(ns word-count
  (:require [clojure.string :refer [split lower-case]]))

(defn word-count [text]
  (let [words (split (lower-case text) #"[^\w\d]+")]
    (apply merge-with +
           (for [w words] {w 1}))))

Comments


You're not logged in right now. Please login via GitHub to comment