On Friday 20 May 2005 08:11, "TSa (Thomas SandlaÃ)" wrote: > John Macdonald wrote: > > ... (and there may be additional > > operator attributes that make sense there too, although none > > come immediately to mind). > > Well, I wonder why people neglect the fact that the > neutral/identity element is not a property of the operator > alone?! Besides the associativity and commutativity of the > operator the inverse element---or the left and right > one---with respect to the underlying representation come at > least to my mind :) Yes, a number of operators have an inverse on Boolean 0 and 1 only. > This would give an "axiomatic" type system: > > class Num does Group[Num,+,0] {...} > class Num does Field[Num,+,0,*,1] {...} > class Str does Monoid[Str,~,''] {...} > > class Complex does Field[Array[2] of Num,+,[0,0],*,[1,0]] > {...} > > class 3DVector does VectorSpace[Array[3] of Num,+,[0,0,0]] > {...} > > And it provides valuable information to the optimizer. -- Edward Cherlin Generalist & activist--Linux, languages, literacy and more "A knot! Oh, do let me help to undo it!" --Alice in Wonderland http://cherlin.blogspot.comThread Previous | Thread Next