view 98076 @ 4685:3239239ae1bf

<coppro> addquote <zzo38> Syntax highlighting is: sender in cyan, command in bright white, parameters in normal white, long parameters in bright blue (except for the preceding colon) <coppro> wait, you read IRC raw? <zzo38> It isn\'t quite raw; it is in colors.
author HackBot
date Mon, 07 Jul 2014 17:09:02 +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.