You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For series n xs, you would expect that length (series n xs) == min 0 (length xs - n + 1)
If n == 0 and length xs == 0, then length (series n xs) should be 0 - 0 + 1 == 1. This tells us that there is one way to make a series of length 0 from the empty series: the empty series.
If n == 1 and length xs == 0, then length (series n xs) should be 0 - 1 + 1 == 0. This tells us that the empty series contains no series of length 1.
If n == 2 and length xs == 0, then length (series n xs) should be 0 because 0 - 2 + 1 < 0. This too tells us that the empty series contains no series of length 2.
I'm not sure I feel particularly great about the test cases with n == 0 though. They could all be removed, but then someone would just suggest we add them again.
It's probably better to pick exactly one of these two options:
Declare that n == 0 is an error. Therefore series be Int -> String -> Maybe [[Int]], and the result for n == 0 should be Nothing.
The test cases for the Series exercises require that
series 0 [] = [[]]
series _ [] = []
This seems counterintuitive and is not documented in the problem description.
Is there a reason why the test cases were chosen like this?
The text was updated successfully, but these errors were encountered: