Micah Martin has done the Coin Change Kata in Clojure. His collegue did it in Ruby (presented in the end of the Micah's post). I don't like either of the solutions. The Clojure one is almost unreadable - it's extreamly hard to understand what's really going on - take, map, mapcat, repeat - it's just too many too general constructs for such a simple problem. The Ruby one is readable and straitforward, though it's imperative and uses mutable vars, which I don't like very much these days.

So, let's look at what code I wrote in 5 minutes in F#. What's interesting, it worked the first time as was compiled:


Popular posts from this blog

Upcoming F# struct tuples: are they always faster?

Computing cryptography hashes: Rust, F#, D and Scala

Composing custom error types in F#