I made two solutions to part two in JavaScript the first uses a more imperative approach, and the second was meant to mimic the Elixir solution using recursion. The issue with that is JavaScript not being tail call optimized. In order to get around that I used a trampoline function and a while loop. Though, that approach is insanely slow.
Wow, this is really cool! I completed day one too, but my code is nowhere near that clean. Could you recommend any resources that helped you get into Elixir?
Thanks for making this post and sharing your solutions!
Here are my solutions in Elixir and JavaScript.
To start a couple functions to parse the input.
Part one's solutions.
Part two's solutions.
This solution takes advantage of Elixir's recursion, pattern matching, and multiple function clauses.
I made two solutions to part two in JavaScript the first uses a more imperative approach, and the second was meant to mimic the Elixir solution using recursion. The issue with that is JavaScript not being tail call optimized. In order to get around that I used a trampoline function and a while loop. Though, that approach is insanely slow.
Wow, this is really cool! I completed day one too, but my code is nowhere near that clean. Could you recommend any resources that helped you get into Elixir?
Thanks! This sounds like a cop-out answer but the Elixir docs are a great resource. elixir-lang.org/
I'd also be happy to answer any questions you have.