Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion junction adverb: :except
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
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. Listen and type the numbers you hear
 
Luke Palmer  
View profile  
 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
Subject: Re: junction adverb: :except

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.