Fork me on GitHub
#adventofcode
<
2017-12-22
>
mfikes00:12:22

Hah. I forgot core has even?—no need to (zero? (mod x 2))

mfikes00:12:13

On a more interesting note, I sorted out how to transduce all the way through with no intermediate data structures

mfikes00:12:44

This results in it processing an arbitrary number of iterations without blowing out memory

mfikes00:12:56

The mind bending bit is to replace an (into [] ...) in the core of the algorithm with an (eduction ..) which causes all the steps to complete immediately, followed by a long phase of another transduce at the end where it does all the calculations essentially lazily.

mfikes00:12:17

The learning: you can iterate where each step returns an eduction. Cool!

ihabunek10:12:15

that's impressive

ihabunek10:12:58

i need to study your code, it's way above my current understanding of clojure 🙂

mfikes13:12:03

The motivation is that if you do it this way in ClojureScript, you work around the lack of locals clearing. In other words, in CloureScript you are always holding head.

orestis12:12:26

Bah. Day 21 is so fiddly.

orestis12:12:45

You can have both rotations and flips?

orestis12:12:59

Phew, I had the rotations/flips logic wrong, I got a hint from @borkdude and now my code works for both parts, even though I didn’t take into account any ordering or whatever.

orestis12:12:04

Now to read other code.

orestis12:12:18

@bhauman Ahh, fantastic transpose/flip/rotate functions.

mfikes13:12:48

The patch that helps tremendously in ClojureScript for problems involving reducing over large amounts of iterate, repeat and cycle (which a lot of the AoC problems seem to do) is now in https://dev.clojure.org/jira/browse/CLJS-2445

bhauman15:12:29

just increase the complexity of the state transitions and it will have to take more time

bhauman15:12:52

this seems to be their strategy this year

borkdude16:12:36

is that different than last year? I stopped at day 7 or so last year

bhauman16:12:46

if I remember correctly they had more stumpers in the last two advents

borkdude16:12:32

maybe they’re trying to make it more mainstream now? 😉

borkdude16:12:57

if you’re bored with today’s ant, here’s another game: https://github.com/wouter-swierstra/ants/blob/master/ants.pdf

thegeez16:12:28

I remember last year to be more about best first searching, this year iterate seems to always suffice

orestis17:12:13

Last year there was A* and other graph search algorithms.

spfeiffer17:12:11

Still being at '15 day 22 you guys won't motivate me to look into '16 and '17 ☺️

orestis17:12:48

’17 feels much easier. Usually the last couple of days are simple, what with people solving the puzzle over the holidays.

orestis17:12:06

This year for some reason I really don’t want to refactor any code. I wonder if Clojure is scaring me.

mfikes18:12:36

FWIW, I refactor heavily. The first version I write works but is garbage. 🙂

borkdude18:12:57

Same for me.

bhauman19:12:08

is there an ascicinema like way to record what happens in an emacs buffer?

bhauman19:12:05

well i guess I could run in the terminal

bhauman19:12:25

which shouldn't be too hard