This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-12-08
Channels
- # adventofcode (15)
- # aleph (2)
- # announcements (1)
- # beginners (5)
- # biff (18)
- # cider (2)
- # clj-commons (13)
- # clj-kondo (7)
- # cljs-dev (7)
- # clojure-europe (23)
- # clojure-ireland (1)
- # clojure-nl (1)
- # clojure-norway (7)
- # clojure-spec (3)
- # clojure-uk (2)
- # cursive (21)
- # emacs (3)
- # honeysql (1)
- # humbleui (7)
- # hyperfiddle (6)
- # introduce-yourself (1)
- # london-clojurians (1)
- # nbb (8)
- # overtone (3)
- # re-frame (15)
- # shadow-cljs (12)
- # squint (12)
- # tools-deps (1)
- # xtdb (1)
https://gitlab.com/maximoburrito/advent2023/-/blob/main/src/day08/main.clj After getting tricked by not trying the brute force approach, this time I wasted time on a brute force solution. When it was clear it wouldn't work, I wrote some code to explore the data a bit. Thankfully all the cycles repeated exactly, so it it was easy to calculate the solution and math where they all meet.
solution: https://github.com/erdos/advent-of-code/blob/master/2023/day08.clj
went with counting reductions
over the cycle
of the instructions and using reduced
to shortcut.
https://gist.github.com/andrewbelo/7d0ae27b04da17da2b44081fc81f985c
Pretty much the same solution, using reduce
over the cycle
Thank you norman for the hint. https://github.com/arnaudgeiser/advent-of-code/blob/master/2023/clojure/src/advent_of_code/day8.clj
Nice solution @UA2U3KW0L!
mapcat
would be a good candidate on line 11:
;;(into {} (comp (map parse-mapping) cat) mappings)
VS
(into {} (mapcat parse-mapping) mappings)
My version of day 8 part 1 : https://github.com/prestancedesign/advent-of-babashka-template/blob/main/src/aoc23/day08.cljc
Not sure about transduser (need chek at clojredocs), but it is definitelly List monads bind, so that is why it widelly used in algorythms based on lists 😀
here's my solution: https://github.com/rmrt1n/advent-of-code-2023-clj/blob/main/src/aoc/day08.clj
I just did day 8 In Clojure, having previously done it Kotlin. I'm pretty proud of how much more succinct my Clojure solution (very functional) is than my Kotlin one (which is a bit more OO). https://github.com/cdpjenkins/advent-of-code/blob/main/2023/clj-aoc-2023/src/clj_aoc_2023/day08.clj