Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Splitting list into n-tuples [duplicate]

Tags:

haskell

How can I split a list into list of tuples/lists of specified length? splitBy :: Int -> [a] -> [[a]]

splitBy 2 "asdfgh" should return ["as", "df", "gh"]

like image 991
synapse Avatar asked Feb 17 '26 11:02

synapse


1 Answers

splitEvery usually gets the nod for this job.

like image 125
Anthony Avatar answered Feb 19 '26 11:02

Anthony