@@ 33,10 33,10 @@
;;; [3, 0, 0, 4, 8, 1, 1, 7, 9]
;;; ]); // => false
-(defn valid-set? [column]
- (and (= 1 (apply min column))
- (= 9 (apply max column))
- (= 9 (count (distinct column)))))
+(defn valid-group? [group]
+ (and (= 1 (apply min group))
+ (= 9 (apply max group))
+ (= 9 (count (distinct group)))))
(defn board->columns [board]
(map (fn [col]
@@ 54,6 54,4 @@
(defn valid-solution [board]
(let [columns (board->columns board)
blocks (board->blocks board)]
- (and (every? valid-set? board)
- (every? valid-set? columns)
- (every? valid-set? blocks))))
+ (every? valid-group? (concat board columns blocks))))