Fork me on GitHub
#adventofcode
<
2021-02-17
>
Joe11:02:57

I struggled with some of the problems where the natural (and efficient) solution was ‘bash on this array <tel:1000000|1000000> times’. It introduced me to int-array, aget, aset etc, but it always felt quite clunky compared to doing similar things in a traditional loopy imperative language. Is this just something that Clojure is not idiomatic for, or is it more a case of getting used to the pattern?

Phil Shapiro14:02:19

My take is that the need for this kind of optimization doesn’t come up often. When it does, there are ways to get around it without having to write something in Java (or C). If there was more need for this, then most likely Clojure would evolve to have better support for it. For advent2020, I only needed to do this once, for day 23.

AC22:02:00

same here - int-array + type-hinting made my day 23 solution run in seconds vs days.