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

Re: reduce metaoperator on an empty list

Thread Previous | Thread Next
From:
mark.a.biggar
Date:
May 23, 2005 13:56
Subject:
Re: reduce metaoperator on an empty list
Message ID:
052320052054.21378.429242FB000929620000538222007374789D0E0909070DD20ED2059D0E03@comcast.net

There are actuall two usefull definition for %.  The first which Ada calls 'mod' always returns a value 0<=X<N and yes it has no working value that is an identity.  The other which Ada calls 'rem' defined as follows:

Signed integer division and remainder are defined by the relation: 

A = (A/B)*B + (A rem B)

   where (A rem B) has the sign of A and an absolute value less than the absolute value of B. Signed integer division satisfies the identity: 

(-A)/B = -(A/B) = A/(-B)

It does have a right side identity of +INF.

--
Mark Biggar
mark@biggar.org
mark.a.biggar@comcast.net
mbiggar@paypal.com


> HaloO Mark,
> 
> please don't regard the following as obtrusive.
> 
> you wrote:
> > If as usual the definition of a right identity value e is that a op e = a for 
> all a,
> > then only +inf works.  Besdies you example should have been;
> 
> Or actually $n % any( abs($n)+1 .. Inf ) to really exclude 0
> from the junction.
> 
> > $n % any (($n+1)..Inf),  $n % $n = 0. 
> 
> That depends on the definition of % and the sign of $n.
> With the euclidean definition 0 <= ($n % $N == $n % -$N) < abs($N)
> and for $n < 0 there's no identity at all. The identity element
> has to be an element of the set, which +Inf isn't. It's a type.
> 
> BTW, is % defined as truncation in Perl6?
> That would be a bit unfortunate. Simple but not well thought out.
> -- 
> 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