Wednesday, September 23, 2015

Kata: Word wrap in Clojure

Last night I did the Word Wrap kata in Clojure.

It was proposed in the last Barcelona Software Craftsmanship coding dojo but I couldn't attend, so I did it at home.

These are the tests using Midje:

and this is the resulting code:

As usual I used a mix of TDD and REPL-driven development committing after each green and each refactoring. I also committed the REPL history. See all the commits here to follow the process.

Once I got to a tail recursive solution, I tried to make it more readable by extracting some explanatory helpers and working in the naming of bindings, functions and function arguments.

You can find all the code in GitHub.

No comments:

Post a Comment