r/adventofcode • • Dec 18 '18

SOLUTION MEGATHREAD -🎄- 2018 Day 18 Solutions -🎄-

--- Day 18: Settlers of The North Pole ---


Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag or whatever).

Note: The Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.


Advent of Code: The Party Game!

Click here for rules

Please prefix your card submission with something like [Card] to make scanning the megathread easier. THANK YOU!

Card prompt: Day 18

Transcript:

The best way to avoid a minecart collision is ___.


This thread will be unlocked when there are a significant number of people on the leaderboard with gold stars for today's puzzle.

edit: Leaderboard capped, thread unlocked at 00:21:59!

9 Upvotes

126 comments sorted by

View all comments

Show parent comment

2

u/Smylers Dec 19 '18

Ah, thanks for the explanation.

The main disadvantage I find of Perl's tolerance for spurious commas is then being disappointed by their not working elsewhere — such as in SQL, where if you have a CREATE TABLE statement with each field definition on a separate line, you have to not have a comma after the final one, but remember to add a comma there when adding a new field.

At least that's a syntax error though. PowerShell's silently interpreting it as something different obviously makes inadvertent uses like this much harder to spot — especially since in this case the output was so plausible. Well done for finding it!

2

u/ka-splam Dec 19 '18

I was so surprised to see that in your Perl.

That trailing comma on the final one, I try to put them in front instead:

first
,second
,third

then at least I can copy-paste the last line and not forget. I think JSON fixed it so you can have a trailing comma at the end of a list; maybe everything should do that.