Thanks everyone- that's been really useful. And yes, frequencies, really throws me every time (as do some of the unintuitively - to me - named functions).
On Wednesday, 10 April 2013 18:27:58 UTC+1, edw...@kenworthy.info wrote: > > So, page 143 of Clojure Programming has an implementation of Conway's Life: > > (defn step > "Yields the next state of the world" > [cells] > (set (for [[loc n] (frequencies (mapcat neighbours cells)) > > :when (or (= n 3) (and (= n 2) (cells loc)))] > > loc))) > > The book claims this to be "an elegant implementation'. > > Now it's been a long while since I wrote code to put food on the table - > but back then if I saw C or C++ code written like this I would describe it > as obfuscated - the sort of thing I would expect to see in the (now > defunct?) annual obfuscated C competition. It's concise and rather clever, > certainly, but hardly self-documenting: it's not very clear what it's doing > at all- with a couple of magic numbers thrown in for good measure. Rather > arcane in fact. > > Is it just me? Is this considered to be good Clojure code and I'm just > hopelessly out of touch and need to get with the programme? > > > > > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.