Alright, so I kind of just remembered that there was still one chapter left to go – so here it is! Until _why decides to come out of hiding and write an 8th chapter (whenever that happens, if ever…), this will be the final installment of my translation of _why’s (poignant) guide to ruby into Clojure.
This is kind of a weird chapter in that the whole thing is hand-drawn (by one of the foxes, presumably), making the actual code examples a little hard to find. I feel like I’ve hit all the important bits that would constitute “examples.” This is kind of a short chapter in terms of code content, but it’s a fun one nonetheless. We’ve got a very brief example of how you might build a text adventure game using classes and metaprogramming, a function that takes a string and turns it upside-down, an example of overloading an arithmetic operator to work on arrays, and an interesting encryption algorithm.
I noticed in the “Decody” example that _why made a small, but confusing mistake when commenting his code: In the lines of code referring to 2 letters on the same row, he commented “on the same column,” and vice versa. I have corrected this for the sake of clarity (and to avoid confusing myself!).