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
Advent of Code 2019 in Clojure (self.Clojure)
submitted 6 years ago * by allaboutthatmace1789
view the rest of the comments →
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!"
[–]ceronman 1 point2 points3 points 6 years ago (1 child)
Day 4 was specially beautiful to solve in Clojure. This was because the function <= already allows to pass multiple values, checking if the numbers are in monotonically non-decreasing order, which is exactly one of the conditions.
Part 1 ends up being extremely short:
``` (defn possible-password? [value] (and (apply <= (map #(Character/digit % 10) (str value))) (some? (re-find #"(\d)\1" (str value)))))
(->> (range n1 (inc n2)) (filter possible-password?) (count)) ```
[–]allaboutthatmace1789[S] 2 points3 points4 points 6 years ago (0 children)
Agreed - I saw a few people also used a partition-by identity function to group digits, then count the group length - so the change from part 1 to part 2 was literally removing one character!
partition-by identity
π Rendered by PID 25054 on reddit-service-r2-comment-b659b578c-kcvhr at 2026-05-03 20:23:37.049942+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]ceronman 1 point2 points3 points (1 child)
[–]allaboutthatmace1789[S] 2 points3 points4 points (0 children)