Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Removing parts of an infinite list
-- http://stackoverflow.com/questions/13026095/lack-of-understanding-infinite-lists-and-seq-operator
module Main
where
main :: IO ()
main = print (take 100 (foo 2 [1..]))
foo :: Int -> [a] -> [a]
foo n l = go l
where
go xs = let (toKeep, rest) = splitAt n xs
in toKeep ++ go (drop n rest)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.