Created
October 12, 2014 15:22
-
-
Save balajisivaraman/793863922877f0fc5679 to your computer and use it in GitHub Desktop.
Doctest Testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- >>> skips "ABCD" | |
-- ["ABCD","BD","C","D"] -- This passes. | |
-- >>> skips "ABCD" | |
-- ["ABCD", "BD", "C", "D"] -- This doesn't pass. I assume because of the whitespace. Why? | |
-- But both are equal according to GHCi. | |
skips :: [a] -> [[a]] | |
skips l = map (getItems l) [1..length l] | |
where | |
getItems :: [a] -> Int -> [a] | |
getItems l n = map (l !!) [n-1,2*n-1..length l - 1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment