Diary: Roman numerals clojure kata practice

I started today attempting to solve the Roman numerals kata, ended the day trying to shave off every possible second.

. A kata that I’ve done countless times but never done before in Clojure but more importantly in a functional language.

How difficult could it be?

It was surprisingly challenging because you have handle conditionals differently, loops differently and not mutable variables.  Usually when doing the kata in a language like C#/Ruby, you can happily declare a variable, such as a string which you mutate and finally return once you’ve built it. None of that in Clojure. Now I can say I’m kinda glad.

I’m tired of mutated states, in my cases it’s not needed, at times it makes the code harder to read, at worse it causes side effects.

I’m plan on practicing on my kata to get it down to 7 minutes, it’s currently around the 10minutes mark and I keep making needless errors. I find the final recursion part of the solution when the conversion array is revealed takes too long. Ideally there should be a short gap between running the tests and still be in the green phase.

I need to take a deeper look at how I’m approaching it, I’m sure there’s something I’m missing.

Final part of the jigsaw is to pick an awesome song to pump me up during the Kata presentation on Friday.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s