view 98076 @ 4657:da987f0b6226

<oerjan> addquote <shachaf> you open the third door and behind it is an argument about the monty hall problem
author HackBot
date Wed, 11 Jun 2014 09:56:25 +0000
parents b70362a4c382
children
line wrap: on
line source

-- Hi everyone!
-- Could please someone explain me an output of the function:

splitEvery n list = first : ( splitEvery n rest )
    where (first, rest) = splitAt n list

-- it returns a lis of lists splitEvery :: Int -> [a] -> [[a]]
-- But I don't understand how it works, why it returns list of lists.
-- splitAt returns TUPLE and "first" is somehow joined to it.