adventofcode

Happy Advent 2020! Please put answers in the pinned threads or create one if it does not exist yet. | https://github.com/adventofcode-clojurians/adventofcode-clojurians | Join the private leaderboard with code 217019-4a55b8eb
Joe 2021-02-17T11:52:57.036700Z

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 Shapiro 2021-02-17T14:32:19.038900Z

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.

AC 2021-02-17T22:59:00.040400Z

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