
6 Nov
2003
6 Nov
'03
5:22 a.m.
[replying to self, oops]
getNotes n@(Note _ _ _) = [n]
[..] But of course every function of this form *is a fold* and can be written as such.
Oops, I didn't look closely enough at this line. As written, this *isn't* a fold because it examines the item (Note _ _ _ :: Music) directly rather than just looking at its arguments. But (a) it's academic in this case - since none of the arguments are recursive, you can just write getNotes (Note p o d) = [Note p o d] and become a fold again; and (b) you don't need to return the note to count it, you need only to add one to a counter. --KW 8-)