Guest User

Untitled

a guest
Oct 30th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (defn compute-count [counts char]
  2.     (assoc counts char (inc (counts char 0))))
  3.  
  4. (defn char-count [str]
  5.     (reduce compute-count {} str))
  6.    
  7. (char-count "Cool stuff here.") => {\space 2, \C 1, \e 2, \f 2, \h 1, \l 1, \. 1, \o 2, \r 1, \s 1, \t 1, \u 1}
Add Comment
Please, Sign In to add comment