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

Re: reduce metaoperator on an empty list

Thread Previous | Thread Next
From:
=?ISO-8859-1?Q?=22TSa_=28Thomas_Sandla=DF=29=22?=
Date:
May 20, 2005 08:12
Subject:
Re: reduce metaoperator on an empty list
Message ID:
428DFE3D.9020302@orthogon.com
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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About