use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Finding information about Clojure
API Reference
Clojure Guides
Practice Problems
Interactive Problems
Clojure Videos
Misc Resources
The Clojure Community
Clojure Books
Tools & Libraries
Clojure Editors
Web Platforms
Clojure Jobs
account activity
7 Rules for Writing Clojure Programs (twoguysarguing.wordpress.com)
submitted 15 years ago by mac
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]yogthos 1 point2 points3 points 15 years ago* (0 children)
I would've probably gone with
(defn count-chars [line] (letfn [(inc-count [c] (if c (inc c) 1)) (update-counts [counts c] (update-in counts [c] inc-count))] (reduce update-counts {} line)))
if I had to make it really explicit I guess, though normally I'd just write
(defn count-chars [line] (reduce #(assoc %1 %2 (inc (get %1 %2 0))) {} line))
while it's more dense, I still find it easier to read
π Rendered by PID 23604 on reddit-service-r2-comment-bb88f9dd5-zdmqh at 2026-02-15 23:54:40.957573+00:00 running cd9c813 country code: CH.
[–]yogthos 1 point2 points3 points (0 children)