The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Message from discussion junction adverb: :except

From:
To:
Cc:
Followup To:
Subject:
 Validation: For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon.

More options Apr 18 2005, 7:08 pm
Newsgroups: perl.perl6.language
From: l...@luqui.org (Luke Palmer)
Date: Mon, 18 Apr 2005 17:08:36 -0600
Local: Mon, Apr 18 2005 7:08 pm

David Christensen writes:
> 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...

No, you're abusing adverbs.  You can't give an adverb to a variable
(because adverbs don't modify actually nouns :-).  I don't know if we've
destroyed Damian's comparator semantic, but if not, then you can just
do:

my \$k = (\$j != 2);

But if that no longer happens, it's best a method on the junction.
Except every time we add a method to junction, we destroy the ability to
automatically thread that method over the junction.  I've proposed
several solutions to this over the years (applying to autodelegating
iterators as well).  I still think it's something that that needs to be
solved.

Luke