[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] create subarray each 4 items



[2,4, 5, 6,1, 3, 6, 3, 6, 2, 4, 1].clump(4)

HTH
-a-

--------------------------------------------------
Andrea Valle
--------------------------------------------------
CIRMA - StudiUm
Università degli Studi di Torino
--------------------------------------------------

"This is a very complicated case, Maude. You know, a lotta ins, a lotta outs, a lotta what-have-yous." 
(Jeffrey 'The Dude' Lebowski)

On Dec 30, 2012, at 8:29 AM, ronni montoya <ronni.montoya@xxxxxxxxx> wrote:

Hi list, i was wondering which is the easiest way for creating a
subarray each 4 items , for example if i have:

[2,4, 5, 6,1 3, 6, 3, 6, 2, 4, 1]

I would like to have:

[[2,4, 5, 6] ,[1 3, 6, 3], [6, 2, 4, 1]]


is there is an easy way instead of creating a function?


cheers

R.

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/