> > What I don't understand is his use of the "T" constructor, both at > > > > insertSet x s = T B a y b > > Here it creates a new RedBlackSet > > > and in the where statement: > > > > T _ a y b = ins s > > Here it's a pattern match. So if ins s returns (T x a' y' > b'), then a = a'; y = y'; b = b' are used in the expresion > covered by the where clause.
If you're wondering how the compiler tells the difference, have a look at section 2.4 of the Haskell 98 Report (Identifiers and Operators). Roughly, an identifier beginning with a lowercase letter or underscore must be a variable identifier, while an identifier beginning with an uppercase letter must be a constructor identifier. In other words, the second example above cannot be the definition of a function called "T", because "T" cannot be the name of a function. _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
