develooper Front page | perl.perl6.language | Postings from May 2005

Re: reduce metaoperator on an empty list

Thread Previous | Thread Next
May 20, 2005 08:12
Re: reduce metaoperator on an empty list
Message ID:
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 :)

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.
TSa (Thomas Sandlaß)

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About