2024-12-08
A quick update on my progress on Advent of code!
These first couple of days were not that interesting as I just stayed in my comfort zone. On day one I used Rust and on day two and three I used Python.
A language I had been wanting to try out was Haskell.
Haskell is a compiled, purely functional language.
I really like the functional approach to programming and the way you have to think about it.
After following their get started page and setting everything up I started my work.
If you had a look at my repo, you would ask yourself: "Why did he say he used Haskell when all the code in the day_04 folder is written in Lua?"
Well...
I severely underestimated the amount of time it would take me to learn Haskell and in the end, I gave up and used Lua instead.
Lua is a small scripting language that is ment to be easy to embed into a project. Writig day 4 in Lua made things quite a bit easier.
The only thing that took a bit of time to wrap my head around were lua tables. (And also that they start at index 1)
On day 5 I used C. Everyone has to learn a bit of C at some point. And though I used it in the past, my C skills had become pretty rusty. It took me a bit to solve the first puzzle, but I could reuse most of the conde from puzzle 1 in puzzle 2.
On day 6 I decided to use Scala. Scala runs on the JVM.
That means it also has interoperability with Java. Scala is a bit more on the functional side though.
I did not have a lot of time on the 6th so I had to do most of the work for day 6 on the 7th.
I have decided to revisit Haskell. It will probably take some time to learn the basics and I will probably have to catch up on the puzzles.
My reason for doing this is because I find Haskell (and the concept of functional programming in general) very interesting.
After starting to learn Haskell I am also beginning to change the way I look at programming problems, which feels very refreshing and exciting.
If you want to look into Haskell yourself, I have found the following resources very useful/enlightening:
- Haskell bit by bit -> exactly what it says
- In search of Code Purity -> A rust focused look at functional programming. (Make sure to watch the chapter about pure functions)
- Haskell is Useless -> A (in my opinion) very good take on functional programming by Simon Peyton Jones
Until next post.
^_^