Permalink
Browse files

separator line length now calculated dynamically

  • Loading branch information...
1 parent e233e42 commit e0fc86aa6235ab08228fd918c1194e9a973e4f66 @bitsai committed Dec 2, 2010
Showing with 4 additions and 2 deletions.
  1. +4 −2 algorithm.clj
View
@@ -75,8 +75,10 @@
(defn display [values]
(let [values-strs (for [s squares] (apply str (@values s)))
rows (partition 9 values-strs)
- lines (for [r rows] (str/join " " (interpose-nth 3 "|" r)))]
- (doseq [line (interpose-nth 3 "---------------------" lines)]
+ lines (for [r rows] (str/join " " (interpose-nth 3 "|" r)))
+ max-line-len (apply max (for [l lines] (count l)))
+ separator-line (apply str (repeat max-line-len "-"))]
+ (doseq [line (interpose-nth 3 separator-line lines)]
(println line))))
(defn search [values]

0 comments on commit e0fc86a

Please sign in to comment.