-
Algorithms
I am starting a new project that I have been thinking about for a while, which is writing up algorithms from CLRS, ideally all of them. I’m releasing all of them on GitHub, should be a pretty fun time. I’m using functional programming when it doesn’t make algorithms asymptotically slower, and I’m writing all of my tests to force myself to get used to writing tests for everything I write.
This is a sort of interesting exercise because it is very strongly structured and it is completely unambiguous what the input and output of each function should be. The only design that needs to be done is algorithmic design, and basically all other concerns can be ignored. I think it can be considered similar to playing old jazz standards, or writing exercises. There is a surprising amount of creativity even in writing simple algorithms, but it isn’t an overwhelming amount. It is good to know that I can really implement all of these algorithms that I can explain, rather than just being able to pontificate on algorithms I would never be able to implement myself.
This is also an opportunity to teach myself Scala. I have found that so far I spend more time fiddling around with Scala rather than actually writing the algorithm, but once I have done that, it just works, which is nice. Pretty much invariably, when I run into a problem, it is because I used state somewhere. Once it type checks, I am rarely unhappy with the result, which is a refreshing change from Python in its dynamic glory, or Java where I need to constantly remind myself to include null checks.