Arc Forumnew | comments | leaders | submitlogin
Advent 2019, day 3, problem 1: Arc vs Python
2 points by akkartik 1582 days ago | 5 comments
Spoiler alert!


Solutions to day 3, problem 1:

Without spoiling anything, I think Python wins here. Mostly thanks to generator expressions and native support for sets. It's equally concise, and I won't dwell on how much faster it is.

One problem with Python: I did the whole thing using lists for co-ordinates and then realized at the end that lists aren't hashable so can't be in sets. So I had to go back and turn all my co-ordinates into tuples.

Couple of minor things on the pro-Arc side of the ledger: `repeat` is lovely, and being expression-oriented gives us the tertiary operator for free in `mag`.

But maybe my Arc is rusty. Have I forgotten any cool functions in our library?

2 points by zck 1581 days ago | link

My solution using Clojure:

As with your Python solution, set operations were nice. `(set/intersection w1positions w2positions)` helped.


2 points by jsgrahamus 1573 days ago | link

Would love to see some output. Thanks, Akkartik!


2 points by jsgrahamus 1573 days ago | link

Also, where do we find


1 point by akkartik 1572 days ago | link

The input is on the problem page. Scroll to the bottom of to 'get your puzzle input'. You should be able to get the output by running the commands I gave. It's just a numeric answer so not super interesting.


2 points by zck 1571 days ago | link

Also notably, the input is different for each user, as is each answer.

So the code should be the same, but you can't use my input to get an answer you can check on their website.