Clojure Koan 15: Destructuring

I am working through the Clojure koans.

I found a guy who did them and put his answers on github (username viebel), and when I am done I check mine against his. I found out you can also look at resources/koans.clj for answers, but they are formatting oddly in that file.

Koan 15 is about destructuring. Some of the problems use a map that is provided in the beginning:

Here is the original problem:

Here is my answer:

Here is the more elegant answer:

So they are taking the vector argument and destructuring it in the argument list itself. And destructuring the map right after it, making two arguments into five. Viebel has a few interesting ways to destructure that I did not know about.

I might replace my answers with the provided answers. Now when I run it, lein takes a relatively long time to get through koan 15.

You’re welcome.