Advent of Code 2022 in Elixir
Caleb Weeks
Posted on December 1, 2022
This year, I am attempting to solve Advent of Code in Elixir. Last year, I attempted to solve Advent of Code in both Haskell and JavaScript as a challenge to learn and teach functional programming in JavaScript, but I didn't make it very far. I hope to post every day (for as far as I can get), but I'll only be sharing the code and highlighting the couple tricks I used to solve the problem.
For the JavaScript and Functional Programming crowd...
If you follow me on dev.to for my usual JavaScript and functional programming articles, sorry to flood your notifications with Elixir posts this month. I plan to write more about JavaScript and functional programming soon, so stay tuned. James Sincalir has a great book that I'd like to follow up on, and I've been playing with some esoteric JavaScript ideas.
Back to Elixir...
Elixir is a functional programming language, but with a very different style. I have a couple conveniences for my Advent of Code setup this year. I don't anticipate being one of the fastest solvers by any means, but it's nice to be able to fetch the input data instead of copying and pasting into a file. I'm also using a library I made called pex which provides an alternative pipe operator for happy case programming. Truthfully, I don't think I'll need to add much error handling anyway, since the goal is simply to get the answer, but it still helps unwrap the occasional ok tuple.
Posted on December 1, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.