Created
December 21, 2014 16:55
-
-
Save Ikke/c413ffe389b021253965 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
module Golf where | |
skips :: [a] -> [[a]] | |
skips xs = map (\i -> takeEvery (fst i) (snd i)) $ createZipList xs | |
where | |
createZipList xs = zip [1..] $ take (length xs) $ repeat xs | |
takeEvery :: Int -> [a] -> [a] | |
takeEvery n xs = | |
case drop (n-1) xs of | |
(y:ys) -> y : takeEvery n ys | |
[] -> [] | |
main = do | |
print (skips []) |
This file contains hidden or 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
Golf.hs:16:5: | |
No instance for (Show a0) arising from a use of ‘print’ | |
The type variable ‘a0’ is ambiguous | |
Note: there are several potential instances: | |
instance Show Double -- Defined in ‘GHC.Float’ | |
instance Show Float -- Defined in ‘GHC.Float’ | |
instance (Integral a, Show a) => Show (GHC.Real.Ratio a) | |
-- Defined in ‘GHC.Real’ | |
...plus 24 others | |
In a stmt of a 'do' block: print (skips []) | |
In the expression: do { print (skips []) } | |
In an equation for ‘main’: main = do { print (skips []) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment