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

Re: reduce metaoperator on an empty list

Thread Previous | Thread Next
From:
=?UTF-8?B?IlRTYSAoVGhvbWFzIFNhbmRsYcOfKSI=?=
Date:
June 9, 2005 09:42
Subject:
Re: reduce metaoperator on an empty list
Message ID:
42A87153.5050200@orthogon.com
Edward Cherlin wrote:
> That means that we have to straighten out the functions that can 
> return either a Boolean or an item of the argument type. 
> Comparison functions < > <= >= = != should return only Booleans,

I'm not sure but Perl6 could do better or at least trickier ;)
Let's assume that < > <= >= when chained return an accumulated
boolean and the least or greatest value where the condition was
true. E.g.

   0 < 2 < 3   returns  0 but true

   1 < 2 < 1   returns  1 but false

   4 < 5 < 2   returns  2 but false

Then the reduce versions [<] and [<=] naturally come out as min
and strict min respectively.

Is it correct that [min] won't parse unless min is declared
as an infix op, which looks a bit strange?

if 3 min 4 { ... }

-- 
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