Advent of Code 2016
Thursday, December 29, 2016 :: Tagged under: personal plt engineering projects. ⏰ 3 minutes.
Hey! Thanks for reading! Just a reminder that I wrote this some years ago, and may have much more complicated feelings about this topic than I did when I wrote it. Happy to elaborate, feel free to reach out to me! 😄
A co-worker linked a few of us to Advent of Code, a coding challenge that released a new puzzle every day for December, leading to the 25th.
I participated as best I could, with a twist: try to write every day's solution in a different programming language. I didn't finish (some explanation follows), but I'm proud of my entries. The list of languages is:
- Day 1: Standard ML (impl, description)
- Day 2: Factor (impl, description
- Day 3: Racket (impl, description)
- Day 4: Ruby (impl, description)
- Day 5: Go (impl, description)
- Day 6: C (impl, description)
- Day 7: Prolog (impl, description)
- Day 8: Haskell (impl, description)
- Day 9: Erlang (impl, description))
- Day 10: C++ (impl, description)
- Day 11: Common Lisp (impl, description)
- Day 12: Rust (impl, description)
- Day 13: Python (impl, description))
- Day 14: Java (impl, description)
- Day 16: Pyret (website) and OCaml (impl), description)
- Day 17: Scala (impl), description)
- Day 18: Elixir (impl, description)
- Day 19: Mercury (impl, description))
- Day 20: Clojure (impl, description)
- Day 21: Lua (impl, description)
- Day 22: Awk preprocessing + SQL.
Some things left to do:
Finish the challenges. I'm missing Part 2 on Days 19 and 22, and all of days 23, 24, and 25.
Clean up the challenges. Originally I'd hoped to always use file input rather than hard-code some inputs, but that went by the wayside. Furthermore, I think it'd be fun to see how I can make certain solutions more idiomatic.
Clean up the READMEs. Most of them have the problem statement, but many are missing inputs, and all are missing Part 2.
Ambitiously, follow-up with Advent of Blog! The Musical!, wherein I write a post about the language I used, some Pablo opinions, things I learned, the choices I made, etc.
Did you learn anything new?
Tons! And I'll hopefully blog about those in the future. Here are a few:
You can write Scheme in any language! I learned that the most powerful influence on my general programming style were those library nights with books like The Little Schemer, Structure and Interpretation of Computer Programs, and Programming Languages: Application and Interpretation.
Most of my code:
- Prefers immutability
- Relies on returning values rather than producing effects
- Frequently relies on recursion
and jumping between SML, OCaml, Haskell, Racket, Clojure, and even Erlang hardly felt like I was using different languages at all.
Logic programming is a lot more fun than I remember it. I've played with Prolog before, but had an absolute blast using it here. Ditto Mercury.
Wow it's nice working with popular languages. When you have a bug in your Mercury or Factor code, you're a bit SOL. It was refreshing getting to, like, debug again, since you couldn't rely on StackOverflow.
Languages I used for the very first time: Factor, Pyret, OCaml, Elixir, Mercury, Lua.
Languages I've used before technically but only on toy projects, like this: SML, Ruby, Prolog, Common Lisp, Rust, Scala, Clojure.
How did this stack up to other programmer puzzle challenges? For reference, I did about 70 problems on Project Euler back in undergrad. These are a fair bit easier: past the first 15-20 problems, PE tended to rely on you having some kind of mathematical or problem-domain insight to massively reduce the search space. These are far simpler: you can usually just throw the most straightforward algorithm at a problem, and that is usually brute-force.
My other big experience was the old Facebook programming puzzles they'd use for hiring (also described here), which tended to be more algorithmic (graph construction/traversal, clever trees, and dynamic programming were popular in those). Few of these required anything quite like that.
More to come, I hope! 😛
Thanks for the read! Disagreed? Violent agreement!? Feel free to join my mailing list, drop me a line at , or leave a comment below! I'd love to hear from you 😄