[Haskell-beginners] Restoring interleaved lists?
patrick.leboutillier at gmail.com
Thu Aug 12 21:11:03 EDT 2010
I'm parsing a file that represents a type of musical notation (Guitar
Pro file format). In the format there are t tracks, each composed of m
measures. In the file the measures are all stored sequentially, i.e.
from measure 1 to measure t*m, in the following fashion:
- measure 1 of track 1 ;
- measure 1 of track 2 ;
- measure 1 of track t ;
- measure 2 of track 1 ;
- measure 2 of track 2 ;
- measure 2 of track t ;
- measure m of track 1 ;
- measure m of track 2 ;
- measure m of track t ;
I need a function that, given t and the list of t*m measures, can
spilt the measures by track, returning a list of t lists, each
containing m measures. I cannot figure out how to do this, even though
it seems to me like it shouldn't be too hard... I can't figure out how
to "update" the lists of lists when I want to add a new element.
Do anyone have any ideas?
Rosemère, Québec, Canada
More information about the Beginners