Live data from Hacker News

Adventures in Advent of Code

davedelong.com

1–10 of 71 posts

Re: Adventures in Advent of Code

#2
When your code fails it's never the fault of the language. It's always ones own fault, a typo, some error in the logic, or something. Debugging always reveals that with a stone face. Always.

Except

> "It turns out, there was a bug in Set.intersection(_:), but it had only been discovered this past June, and the fix hasn’t made it into a public version of Swift yet. "

Re: Adventures in Advent of Code

#3

When your code fails it's never the fault of the language. It's always ones own fault, a typo, some error in the logic, or something. Debugging always reveals that with a stone face. Always. Except > "It turns out, there was a bug in Set.intersection(_:), but it had only been discovered this past June, and the fix hasn’t made it into a public version of Swift yet. "

Don't know what to search for to bring it up but there's a story HN used to post occasionally about finding a CPU bug... talk about Always. Except.

Re: Adventures in Advent of Code

#5

I picked go for my language this year, which doesn't have good support for sets. May end up writing my own buggy implementation of this.

What if you used a map and stored the value as a key? Then get all keys? Could work as a simple alternative and you could check if values are in it.

Requires thinking if you want to implement set difference or intersection. I just figured depending on needs using existing built-in types may be fun.

Re: Adventures in Advent of Code

#6

When your code fails it's never the fault of the language. It's always ones own fault, a typo, some error in the logic, or something. Debugging always reveals that with a stone face. Always. Except > "It turns out, there was a bug in Set.intersection(_:), but it had only been discovered this past June, and the fix hasn’t made it into a public version of Swift yet. "

(Hi, I'm the author of the post)

It turns out the bug fix has been released publicly, but only on newer OS versions.

Re: Adventures in Advent of Code

#8
post #5

I picked go for my language this year, which doesn't have good support for sets. May end up writing my own buggy implementation of this.

What if you used a map and stored the value as a key? Then get all keys? Could work as a simple alternative and you could check if values are in it. Requires thinking if you want to implement set difference or intersection. I just figured depending on needs using existing built-in types may be fun.

You don't need a map for AoC 2022 day 3. There's only 52 elements. Which means a 64-bit bitmask is sufficient.

Re: Adventures in Advent of Code

#9
I'll be doing AoC in C this year. And I've decided to do that every year as I enjoy doing it in C and trying to get the entire calendar, all 50 parts to run in less than one second on a single core, which it turns out is quite doable, but only with a much deeper understanding of the problems. I end up learning a lot more computer science this way.

I also like it since I don't do any work or even side projects in C these days, and so it's nice to keep my C chops up to scratch.

Re: Adventures in Advent of Code

#10

When your code fails it's never the fault of the language. It's always ones own fault, a typo, some error in the logic, or something. Debugging always reveals that with a stone face. Always. Except > "It turns out, there was a bug in Set.intersection(_:), but it had only been discovered this past June, and the fix hasn’t made it into a public version of Swift yet. "

Yeah, luckily, those exceptions are really rare. Last time one happened to me I wasted three days before finding the culprit.
Post reply on HN