Last active
June 25, 2017 17:20
-
-
Save parsonsmatt/508d8b72852344da937f1570ae0ff139 to your computer and use it in GitHub Desktop.
repeats
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
-- me | |
skips :: [a] -> [[a]] | |
skips xs = zipWith takeEvery [1..length xs] (repeat xs) | |
takeEvery :: Int -> [a] -> [a] | |
takeEvery n xs | |
| n > length xs = [] | |
| otherwise = xs !! (n-1) : takeEvery n (drop n xs) | |
-- the guy she tells me not to worry about | |
repeats :: [a] -> [[a]] | |
repeats xs = | |
map (map fst . filter snd) | |
. zipWith zip (map (const xs) xs) | |
. map cycle | |
. iterate (False :) | |
$ [True] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment