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
fellshard 2019-12-21T01:02:59.045400Z

I'd like to think my parsing for it ended up fairly clean. The different arities of map are major helps in this.

fellshard 2019-12-21T05:40:25.045600Z

the heck

fellshard 2019-12-21T05:40:56.046300Z

My second program ended up being absurdly easy - I went with a very dumb initial heuristic thinking it would show me the next failed test, but nope, that was it

misha 2019-12-21T09:44:15.046900Z

low level mutability :eew:

πŸ‘Œ 1
misha 2019-12-21T12:10:01.049300Z

trying to write fn to translate sexpressions line (and a (not b)) into AND A J... and those 2 mutable registers are a world of pain

misha 2019-12-21T12:11:34.050500Z

either api forces you to frame sexp from particular point of view, or infinite pain

2019-12-21T16:09:17.052700Z

You can translate boolean expressions...

2019-12-21T16:10:50.052800Z

using de morgan's laws to change (and (not x) (not y)) to (not (or x y)) to save register space

2019-12-21T16:12:01.053Z

Any expression that has more than one non-trivial operand is going to take up both of your registers

2019-12-21T16:16:01.053200Z

So simplify the operands of any binary op until at least one of them is a trivial register. Unary ops can be computed with a single mutable register.

misha 2019-12-21T17:03:27.053400Z

all of this is true. I wanted user not to worry about shape of the tree. But reshaping a tree with a bunch of substitution rules is not an easy task as well. but yeah, can be done for sure.

Alper Cugun 2019-12-21T20:57:02.054400Z

I read half the book and threw this together: https://github.com/alper/aoc2019/blob/master/3.clj It’s a bit slow so suggestions of how to speed it up are very much welcome.

Alper Cugun 2019-12-22T20:05:57.059400Z

Just removing last and concat resulted in a 20x speed gain:

Alper Cugun 2019-12-22T20:06:05.059600Z

Elapsed time: 7390.580613 msecs Elapsed time: 372.936439 msecs

Alper Cugun 2019-12-22T20:06:12.059800Z

Thanks for that and the other hints.

πŸ‘ 1
Alper Cugun 2019-12-21T22:45:13.054600Z

It turns out that all time is spent in generate_points_from_steps.If anybody has a solution for this I can take a look at that would also be appreciated.