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

junction adverb: :except

Thread Next
From:
David Christensen
Date:
April 18, 2005 16:01
Subject:
junction adverb: :except
Message ID:
1b0696bcc9cb5aa9a5522334f1df6a71@dwci.net
Hypothetical here:

If we want to calculate a set of values for a junction which map nicely 
to a range with a few outliers, would it be possibly to have a 
qualifier :except which allows us to make exceptions to our given 
range?  I.e.,

(Ignore for the moment the inefficiency of the choice of this 
particular algorithm.)

my $year = 1900;  # or whatever

my $leap_year = $year % 400 == any(0..400 :by(4) :except(100,200,300));

Here except would be a modifier on the range being generated for any(). 
  I could also see except being used to "strip choices" from junctions:

my $j = 1|2|3|4;
my $k=$j :except(2);  # 1|3|4

Let me know if I'm totally abusing junctions here...

David


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