Re: REs as generators

2002-12-12 Thread Nicholas Clark
On Wed, Dec 11, 2002 at 06:53:20PM -0800, Randal L. Schwartz wrote: > > "Rich" == Rich Morin <[EMAIL PROTECTED]> writes: > > Rich> On occasion, I have found it useful to cobble up a "little language" > Rich> that allows me to generate a list of items, using a wild-card or some > Rich> other sy

Re: REs as generators

2002-12-12 Thread Luke Palmer
> Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm > Date: Wed, 11 Dec 2002 17:24:54 -0800 > From: Dave Storrs <[EMAIL PROTECTED]> > Mail-Followup-To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > Content-Disposition: inline > X-SMTPD: qpsmtpd/0.20, http://develooper.com/code/qpsmtpd/ > > On Thu,

Re: REs as generators

2002-12-12 Thread Dave Storrs
On Thu, Dec 12, 2002 at 10:35:47AM +1100, Damian Conway wrote: > Dave Storrs wrote: > > - the ability for the programmer to set "limiters" (??better name??) > > on the junction, which will specify how the junction should > > collapse--e.g. always collapse to the lowest/highest value that hasn't > >

Re: REs as generators

2002-12-11 Thread Randal L. Schwartz
> "Rich" == Rich Morin <[EMAIL PROTECTED]> writes: Rich> On occasion, I have found it useful to cobble up a "little language" Rich> that allows me to generate a list of items, using a wild-card or some Rich> other syntax, as: Rich>foo[0-9][0-9] yields foo00, foo01, ... Rich> I'm wonderi

Re: REs as generators

2002-12-11 Thread Damian Conway
Dave Storrs wrote: On Tue, Dec 10, 2002 at 10:37:10PM -0700, Luke Palmer wrote: Why use regexen when you can just use junctions? my $foos = 'foo' ~ any(0..9) ~ any(0..9); At what moment does a junction actually create all of its states? Hmm...perhaps a clearer way to say that is "At what

Re: REs as generators

2002-12-11 Thread Damian Conway
Luke Palmer asked: Can junctions have methods? If we decide they can, yes. ;-) How do you tell the difference between calling a junction's method and > calling a method on each of its states? If it's a method of the class Junction (or one of its four subclasses) then it's a method call on

Re: REs as generators

2002-12-11 Thread Dave Storrs
On Tue, Dec 10, 2002 at 10:37:10PM -0700, Luke Palmer wrote: > Why use regexen when you can just use junctions? > > my $foos = 'foo' ~ any(0..9) ~ any(0..9); At what moment does a junction actually create all of its states? Hmm...perhaps a clearer way to say that is "At what moment does a ju

Re: REs as generators

2002-12-11 Thread Dave Storrs
On Tue, Dec 10, 2002 at 03:38:58PM -0800, Rich Morin wrote: > On occasion, I have found it useful to cobble up a "little language" > that allows me to generate a list of items, using a wild-card or some > other syntax, as: > > foo[0-9][0-9] yields foo00, foo01, ... > > I'm wondering whether Pe

Re: REs as generators

2002-12-11 Thread Luke Palmer
> Date: Wed, 11 Dec 2002 19:15:53 +1100 > From: Damian Conway <[EMAIL PROTECTED]> > > I suspect C may be a method only, so that would be either: > >my @foos = states $foos:; > > or: > >my @foos = $foos.states; > > Though, I suppose we might argue that C is as fundamental to Per

Re: REs as generators

2002-12-11 Thread Rich Morin
At 10:37 PM -0700 12/10/02, Luke Palmer wrote: Why use regexen when you can just use junctions? my $foos = 'foo' ~ any(0..9) ~ any(0..9); ... We have a I language on our hands, people. Agreed, but this solution doesn't work well for all cases. For example, what if I want to iterate throug

Re: REs as generators

2002-12-11 Thread Damian Conway
Luke Palmer wrote: LP> my $foos = 'foo' ~ any(0..9) ~ any(0..9); Actually $foos will be a junction. You could use C to get each state out of the junction in an array. my @foos = states $foos; Luke's right on target (as usual :-). Just one slight niggle. I suspect C may be a method

Re: REs as generators

2002-12-10 Thread Uri Guttman
> "LP" == Luke Palmer <[EMAIL PROTECTED]> writes: LP> my $foos = 'foo' ~ any(0..9) ~ any(0..9); >> >> should that be @foos or will it make an anon list of the foos and store >> the ref? LP> Actually $foos will be a junction. You could use C to get LP> each state out of the junct

Re: REs as generators

2002-12-10 Thread Luke Palmer
> Cc: [EMAIL PROTECTED], [EMAIL PROTECTED] > From: Uri Guttman <[EMAIL PROTECTED]> > Date: Wed, 11 Dec 2002 00:43:13 -0500 > > > "LP" == Luke Palmer <[EMAIL PROTECTED]> writes: > > LP> Why use regexen when you can just use junctions? > > LP> my $foos = 'foo' ~ any(0..9) ~ any(0..9);

Re: REs as generators

2002-12-10 Thread Uri Guttman
> "LP" == Luke Palmer <[EMAIL PROTECTED]> writes: LP> Why use regexen when you can just use junctions? LP> my $foos = 'foo' ~ any(0..9) ~ any(0..9); should that be @foos or will it make an anon list of the foos and store the ref? LP> We have a I language on our hands, people. i k

Re: REs as generators

2002-12-10 Thread Luke Palmer
> Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm > Date: Tue, 10 Dec 2002 15:38:58 -0800 > From: Rich Morin <[EMAIL PROTECTED]> > X-SMTPD: qpsmtpd/0.20, http://develooper.com/code/qpsmtpd/ > > On occasion, I have found it useful to cobble up a "little language" > that allows me to generate

Re: REs as generators

2002-12-10 Thread Luke Palmer
> Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm > Date: Tue, 10 Dec 2002 21:07:34 -0500 > From: Adam Turoff <[EMAIL PROTECTED]> > Cc: [EMAIL PROTECTED] > Content-Disposition: inline > X-SMTPD: qpsmtpd/0.20, http://develooper.com/code/qpsmtpd/ > > On Tue, Dec 10, 2002 at 03:38:58PM -0800, R

Re: REs as generators

2002-12-10 Thread Adam Turoff
On Tue, Dec 10, 2002 at 03:38:58PM -0800, Rich Morin wrote: > On occasion, I have found it useful to cobble up a "little language" > that allows me to generate a list of items, using a wild-card or some > other syntax, as: > > foo[0-9][0-9] yields foo00, foo01, ... > > I'm wondering whether Pe

Re: REs as generators

2002-12-10 Thread Uri Guttman
> "RM" == Rich Morin <[EMAIL PROTECTED]> writes: RM> On occasion, I have found it useful to cobble up a "little language" RM> that allows me to generate a list of items, using a wild-card or some RM> other syntax, as: RM>foo[0-9][0-9] yields foo00, foo01, ... RM> I'm wondering

REs as generators

2002-12-10 Thread Rich Morin
On occasion, I have found it useful to cobble up a "little language" that allows me to generate a list of items, using a wild-card or some other syntax, as: foo[0-9][0-9] yields foo00, foo01, ... I'm wondering whether Perl should have a similar capability, using REs. -r -- email: [EMAIL PROTE