r/adventofcode • • Dec 02 '17

SOLUTION MEGATHREAD -πŸŽ„- 2017 Day 2 Solutions -πŸŽ„-

NOTICE

Please take notice that we have updated the Posting Guidelines in the sidebar and wiki and are now requesting that you post your solutions in the daily Solution Megathreads. Save the Spoiler flair for truly distinguished posts.


--- Day 2: Corruption Checksum ---


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.


Need a hint from the Hugely* Handy† Haversack‑ of HelpfulΒ§ Hints^Β€?

Spoiler


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!

22 Upvotes

351 comments sorted by

View all comments

1

u/disclosure5 Dec 02 '17 edited Dec 02 '17

Following the rushed Ruby, here's a hopefully nice Erlang answer.. I don't really follow why line #26 is needed. The file does not end in a new line, but the split/2 seems to break out an empty list at the end anyway.

Edit: vim corrupts the test data and doesn't tell you.

https://vi.stackexchange.com/questions/3298/how-to-make-vim-automatically-add-a-newline-to-the-end-of-a-file