My solution to 4clojure 73 (Analyze a Tic-Tac-Toe Board) 22 Jan 2012
In my last post I talked about the importance of knowing a language's standard library, using an example from 4clojure. I've continued working through the problems (I've completed about half of them at this point), and I'm finally starting to feel comfortable with the tools at my disposal.
I'm particularly happy with my solution to the "Analyze a Tic-Tac-Toe Board" problem (#73).
It weighs in at 247 non-whitespace characters, which puts it right near the middle of the of the pack length-wise. I could trim some of the length off (and increase efficiency) by combining the two filters, but keeping them separate makes for better readability.
It's nowhere near the most clever solution. The below code (by shockbob) probably wins that prize (of the solutions I've seen):
Still, I'm really happy with the progress I'm making. I'm beginning to feel that the difficulties I'm encountering are less because of unfamiliarity with the language, and more not having a strong grasp on the mental model needed to Clojure (and functional, in general) programming.
慢慢来吧.
- Next: Project Euler solutions in Clojure (1-3)
- Previous: On the importance of knowing the standard library

