r/adventofcode • u/daggerdragon • Dec 12 '16
SOLUTION MEGATHREAD --- 2016 Day 12 Solutions ---
--- Day 12: Leonardo's Monorail ---
Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag/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".
MUCH ADVENT. SUCH OF. VERY CODE. SO MANDATORY. [?]
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!
8
Upvotes
View all comments
Show parent comment
2
u/guibou Dec 13 '16
megaparsec is really great, except for ambiguous grammar or when we need backtracking. I recently gave
Earleya try https://hackage.haskell.org/package/Earley but unfortunately it does not give any way to order ambiguous results..I can remember my younger self saying "I will never use statically typed languages and if I must write a parser, a character encoding library or a date library, I'm quitting computer science". Well, few years later, Haskell and (Mega)Parsec makes me change my mind about static languages and parsers. Well, I'm still waiting for a nice paradigm to handle dates and character encoding ;)