Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

how sad, the infinite case worked and the finite case didn't:

Of course I TDD'ed the fix. Thanks again Laurent.
  • Loading branch information...
commit facaba73237238f0d932437b71e4c87c97fa9f8c 1 parent e8fe8c6
@stuarthalloway authored
Showing with 2 additions and 1 deletion.
  1. +1 −1  src/bowling_game.clj
  2. +1 −0  test/test/bowling_game.clj
View
2  src/bowling_game.clj
@@ -23,7 +23,7 @@
(defn frames
"Converts a sequence of rolls to a sequence of frames"
[rolls]
- (when rolls
+ (when-let [rolls (seq rolls)]
(lazy-seq (cons (take (balls-to-score rolls) rolls)
(frames (drop (frame-advance rolls) rolls))))))
View
1  test/test/bowling_game.clj
@@ -23,6 +23,7 @@
"all ones" (repeat 10 [1 1]) (repeat 1)
"all fives (spares)" (repeat 10 [5 5 5]) (repeat 5)
"all tens (strikes)" (repeat 10 [10 10 10]) (repeat 10)
+ "a partial game" [[1 2] [3 4]] [1 2 3 4]
))
(deftest test-various-games
Please sign in to comment.
Something went wrong with that request. Please try again.