On Thu, Nov 06, 2003 at 03:41:32PM +1100, Thomas L. Bevan wrote:
patty,
what you have written is not a fold. A fold operates over a list. There is no
list in your code, only some sort of tree structure.
I think you are wrong. Folds are not restricted to lists and lists are
also some sort of
I know this doesn't answer your question, but for this example, it might
be easier to use some kind of iterator. In this example:
getNotes :: Music - [Music]
getNotes n@(Note _ _ _) = [n]
getNotes (PlayerPar m1 m2) = getNotes m1 ++ getNotes m2
-- etc etc
[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
At 4:27 AM + 2003/11/06, Patty Fong wrote:
data Music
= Note Pitch Octave Duration
| Silence Duration
| PlayerPar Music Music
| PlayerSeq Music Music
| Tempo (Ratio Int) Music
data Pitch = Cf | C | Cs
type Octave = Int
type Duration = Ratio Int
foldMusic
Continuing Keith's self-reply ...
the Music type involves types
other than Music; so it is fair to say that
ultimately you would need generalised folds
extended to the case of *systems* of datatypes
(cf. Dealing with large bananas). Imagine
for example getPitches :: Music - [Pitch].
Even if a
On Wed, 5 Nov 2003, Simon Peyton-Jones wrote:
| More overlapping:
| Allow any overlapping rules, and apply the most specific rule that
| matches our target. Only complain if there is a pair of matching
| rules neither of which is more specific than the other.
| This follow the spirit of
Brandon Michael Moore wrote:
Great. But I can't build from the source: I'm getting errors about a
missing config.h.in in mk. I'm just trying autoconf, comfigure. I'll look
closer over the weekend.
Use the following (more specifically autoREconf).
The GHC build guide is behind.
cvs -d