I'm somewhat late to the party, but what the hey - it's a quiet Sunday afternoon, and for my own amusement I came up with:
(defn spaces [n] (apply str (take n (repeat ".")))) (defn n->a [n] (char (+ n (int \A)))) (defn a->n [a] (- (int a) (int \A))) (defn gap [n] (spaces (dec (* 2 n)))) (defn diamond [c] (let [l (a->n c)] (when (<= (a->n \A) l (a->n \Z)) (doseq [i (range l)] (println (str (spaces (- l i)) (n->a i) (gap i) (when-not (zero? i) (n->a i))))) (println (str c (spaces (dec (* 2 l))) (when-not (= \A c)))) (doseq [i (reverse (range l))] (println (str (spaces (- l i)) (n->a i) (gap i) (when-not (zero? i) (n->a i)))))))) Normally I'd add a few comments to this code , especially the diamond function - which is at the limit of the density I feel comfortable with. That said - it seems to work. What I find interesting about this is the length of the code compared with the various Java solutions I looked at; looks like Paul Graham was right: http://www.paulgraham.com/power.html -- 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/d/optout.