Re: Another fold question

2003-11-06 Thread Tomasz Zielonka
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

Re: Another fold question

2003-11-06 Thread Keith Wansbrough
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

Re: Another fold question

2003-11-06 Thread Keith Wansbrough
[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

Re: Another fold question

2003-11-06 Thread Dean Herington
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

Re: Another fold question

2003-11-06 Thread Ralf Laemmel
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

RE: Type tree traversals [Re: Modeling multiple inheritance]

2003-11-06 Thread Brandon Michael Moore
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

Re: Type tree traversals [Re: Modeling multiple inheritance]

2003-11-06 Thread Ralf Laemmel
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