This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-12-05
Channels
- # adventofcode (41)
- # bangalore-clj (4)
- # beginners (283)
- # boot (62)
- # clara (9)
- # cljsrn (3)
- # clojure (112)
- # clojure-brasil (1)
- # clojure-greece (1)
- # clojure-korea (6)
- # clojure-russia (99)
- # clojure-spec (29)
- # clojure-uk (12)
- # clojurescript (34)
- # clojurex (5)
- # core-logic (1)
- # cursive (31)
- # datomic (30)
- # devcards (5)
- # editors (19)
- # emacs (31)
- # events (5)
- # garden (4)
- # hoplon (137)
- # lein-figwheel (3)
- # luminus (4)
- # mount (7)
- # off-topic (7)
- # om (18)
- # om-next (3)
- # onyx (88)
- # proton (1)
- # protorepl (6)
- # re-frame (48)
- # reagent (15)
- # spacemacs (41)
- # testing (1)
- # untangled (2)
- # yada (18)
Having a devil of a time with today's. I think it comes down to not being familiar / being able to find documentation on how to use arrays / byte arrays in Clojure.
Scroll down to โArraysโ. Keep in mind they are mutable. That bite me in on of last years challenges.
This problem works at the byte level, not the nibble level. So gotta do a little tinkering to get it working efficiently enough to search such a wide space.
I've been pushing the raw 'just get an answer' code, then going back and refactoring to see what could be done better, etc.
Given how painful it is to calculate these hashes, good time to learn this: is there a 'best method' to cache the resolved portions of an infinite sequence?
my code is here https://github.com/amirci/aoc_clj
Okay, the source I found for MD5 digest did the same thing as the library. Internally, it's using the same thing
I found that by short-circuiting that library's use of byte hash -> BigInteger -> string every time, there was at least a bit of time savings. Might have to profile and measure it later, but I was reaching for straws trying to get a feedback loop going even with the sample data.
But may have been more pain than it's worth. ๐ I mostly used it to filter the initial results so I only generated string reps when I knew those first five nybbles were 0'd out.
In the end, it was by far not the MD5 that was the time constraint, it was me being really really bad about mixing eager and lazy ๐
It does take some time to find all the matches - a couple minutes for my second round, since it has to find over 20 valid hashes until it found its position 3 entry, but that's just compounding the problem
In the end, I did a refactor 'for the fun of it'. Using the swiss arrows library allowed me to A. reuse the initial part of the calculation, and B. run part A and part B pipelines in parallel
@fellshard pretty cool!
Hello, @abarylko told me this is the best place to improve my Clojure! I'm looking forward to solve some AoC with some fellow Clojurians. I have lots to learn ๐
4clojure may be a bit better for basic learning, but last year's AoC challenges are probably great, too ๐
This year's AoC challenges are starting a bit higher level if I recall last year's problems correctly.
Yep, I did last years AoC with Clojure. 4clojure was where I cut my teeth.
I'd consider myself competent, but I want to go from "hobby language" to "professional understanding" in Clojure.
Then this is a fantastic place for it. All the problems have two parts, and usually the second part requires you to change your model or refactor your first solution in some way. Very cleverly written.