[Haskell-cafe] music-related problem

Michael Mossey mpm at alumni.caltech.edu
Sun Jul 4 16:36:41 EDT 2010



Henning Thielemann wrote:
> 
> On Sun, 4 Jul 2010, Michael Mossey wrote:
> 
>> Henning Thielemann wrote:
>>>
>>> On Sun, 4 Jul 2010, Michael Mossey wrote:
>>>
>>>> I can solve a simpler problem which is
>>>>
>>>> computeSoundedEnd :: Item -> [Item] -> Loc
>>>> computeSoundedEnd firstNote notes = compSndEnd (pitch firstNote) notes
>>
>>> You will certainly not be able to make use of foldl or foldr, but you 
>>> may use a manual recursion instead. Just like
>>>
>>> computeAllEnds :: [Item] -> [Item]
>>
>> What makes it harder than this is that the original document is not a 
>> single list of Item's--they are broken into measures.
> 
> That is, you want a function of type
> 
> computeAllEnds :: [Measure] -> [Measure]
> 
> ?

Right, although it occurs to me that it might be superior to represent the 
document as [Item] and give Item a measure-number attribute. There are also 
other measure attributes, so in that case the doc would look like:

data Doc = Doc [MeasureInfo] [Item]



More information about the Haskell-Cafe mailing list