[EMAIL PROTECTED] (Luke Palmer) writes:
> Since we now have an explicit flattening operator (unary *), there's no
> need to differentiate between a "real" list and a reference to one.
What context does "push" impute on its operands?
If
push @a, [1,2,3,4];
and
push @a, 1,2,3,4;
are goi
On Sat, 21 Sep 2002 16:33:31 -0600 (MDT), Luke Palmer said:
> You know, the idea that square brackets are the only things that can
> make lists is starting to really appeal to me. Similar for squiggles
> and hashes. I don't know how many times in my early Perl5 days I did
> this:
> Since we no
According to John Williams:
> On Sat, 21 Sep 2002, Jonathan Scott Duff wrote:
> > (7,) is an abomination. It's one of python's misfeatures that annoys
> > me the most.
>
> Of course, _requiring_ the comma is bad [...]
Well, I don't know about Jonathan, but requiring the comma is exactly
what Py
On Sat, 21 Sep 2002, Jonathan Scott Duff wrote:
>
> Why can't perl be smart enough to figure out what we mean? Something
> along these lines:
>
> (7) # list context
> (3+4) # numeric context (there's a numeric operator in there)
> (3+4,5) # list context (comma trumps the n
[EMAIL PROTECTED] (Markus Laire) writes:
> How do you do C< ($a + $b) * $c > if parentheses are forbidden for
> mathematical expressions?
I thought that , was actually the list constructor, much as => is the
pair constructor. (And hence
a => 1, b => 2
would be a list of pairs.)
Of co
And the one best reason I forgot to include:
How do you do C< ($a + $b) * $c > if parentheses are forbidden for
mathematical expressions?
--
Markus Laire 'malaire' <[EMAIL PROTECTED]>
At 10:52 AM -0500 9/21/02, Jonathan Scott Duff wrote:
>So, you expect 7.pow(2) to work? I'd expect it to be an error (this
>isn't python after all).
Sure, why not? I mean, we already use methods on integers all the
time--what do you thin 12.5 is anyway, other than calling the 5
method on the c
Chip Salzenberg <[EMAIL PROTECTED]> writes:
> According to David Whipp:
> > (7,8,9) == 3 # true
> > (7,8) == 2 # true
> > (7) == 1 # false
> > () == 0 # true?
>
> Hell, yes, why didn't I think of that? This is exactly the same
> problem that afflicts Python's tuple syntax!
v
[EMAIL PROTECTED] (Smylers) writes:
> Does that matter? This example is fairly contrived, and anybody
> actually concerned about this can always use:
>
> $num = @massive.length;
I'd be in favour of forcing people to say this if they want the length
of the array.
But then, it might be that wh
[EMAIL PROTECTED] (Jonathan Scott Duff) writes:
> Why can't perl be smart enough to figure out what we mean?
We're talking about lists, the second most fundamental data structure
in the language.
If we have to resort to much magic to get these right, we're pretty much
doomed from the outset.
--
Luke Palmer wrote:
>On Sun, 22 Sep 2002, Markus Laire wrote:
>You know, the idea that square brackets are the only things that can make
>lists is starting to really appeal to me. Similar for squiggles and
>
>So parens really do provide grouping, not list constructing. Thus, this
>can stay:
On Sun, 22 Sep 2002, Markus Laire wrote:
> > On Sat, Sep 21, 2002 at 11:36:49AM -0600, John Williams wrote:
> > > On Sat, 21 Sep 2002, Jonathan Scott Duff wrote:
> > >
> > > Anyway, (7) or (3+4) should yield a number, not a list, because
> > > otherwise every math expression will break.
> >
> >
> On Sat, Sep 21, 2002 at 11:36:49AM -0600, John Williams wrote:
> > On Sat, 21 Sep 2002, Jonathan Scott Duff wrote:
> >
> > Anyway, (7) or (3+4) should yield a number, not a list, because
> > otherwise every math expression will break.
>
> Why can't perl be smart enough to figure out what we me
On Wed, Sep 18, 2002 at 05:01:35PM +0200, Damian Conway wrote:
> Steve Fink wrote:
>
> >What possible outputs are legal for this:
> >
> > "aaa" =~ /( a { print 1 } | a { print 2 })* { print "\n" } x/
>
> Unless Larry specifies a required semantics, there are potentially very
> many acceptable o
On 21 Sep 2002, Smylers wrote:
> Luke Palmer wrote:
>
> > my @v = $( &func() );
> >
> > Would provide scalar context. But then assign it to a list...
>
> In the course of reading that I developed a concern about memory usage
> when trying to find the size of arrays. As I understand it th
On Mon, Sep 16, 2002 at 10:32:17AM +0300, Markus Laire wrote:
> On 15 Sep 2002 at 22:41, Steve Fink wrote:
>
> Your code seems to backtrack to the beginning at every failure. First
> code only backtracks one char at time.
> > Huh? What implementation is that? I think my naive implementation
> >
On Sat, Sep 21, 2002 at 11:36:49AM -0600, John Williams wrote:
> On Sat, 21 Sep 2002, Jonathan Scott Duff wrote:
> > > I can't tell whether (7).length is asking for the length
> > > of 7 or the length of a list, but I would be badly surprised if
> > > (3+4).pow(2) returned 1 instead of 49.
> >
> >
On 21 Sep 2002, Smylers wrote:
>
> Does that matter? This example is fairly contrived, and anybody
> actually concerned about this can always use:
>
> $num = @massive.length;
>
> So perhaps this isn't a problem.
$num = +@massive;
would also set $num to the length, not the ref.
~ John Willi
On Sat, 21 Sep 2002, Jonathan Scott Duff wrote:
> > I can't tell whether (7).length is asking for the length
> > of 7 or the length of a list, but I would be badly surprised if
> > (3+4).pow(2) returned 1 instead of 49.
>
> So, you expect 7.pow(2) to work? I'd expect it to be an error (this
> isn
On Fri, Sep 20, 2002 at 09:46:58PM -0600, John Williams wrote:
> On Fri, 20 Sep 2002, Jonathan Scott Duff wrote:
> > > But I cannot tell whether (7) is list context or numeric context,
> >
> > Nope, you can't tell without the surrounding context:
> >
> > (7) + 0;# numeric
> > $a =
Tanton Gibbs wrote:
> (7) == 7
>
> why? Otherwise, we couldn't use parens for mathematical expressions
But as Luke Palmer pointed about above, this syntax would make
square brackets redundant, so we could now use those unambiguously for
overriding mathematical precedence ...
(Sorry about t
Luke Palmer wrote:
> my @v = $( &func() );
>
> Would provide scalar context. But then assign it to a list...
In the course of reading that I developed a concern about memory usage
when trying to find the size of arrays. As I understand it the Perl 5
syntax for discovering the number of
On Fri, 20 Sep 2002, Jonathan Scott Duff wrote:
> > But I cannot tell whether (7) is list context or numeric context,
>
> Nope, you can't tell without the surrounding context:
>
> (7) + 0;# numeric
> $a = (7); # list
> (7) == 1; # boolean (same as (7).length =
> > This kind of clever magic always makes me nervous:
> > it introduces subtle bug potentials.
> >
> > (7,8,9) == 3 # true
> > (7,8) == 2 # true
> > (7) == 1 # false
>
> Why is this one false? I'd expect it to be true just as the others.
(7) == 7
why? Otherwise, we couldn't use
On Fri, Sep 20, 2002 at 10:16:38PM -0400, Chip Salzenberg wrote:
> According to John Williams:
> > I believe the last two cases should be:
> > (7,)== 1
> > (,) == 0
>
> Gack! It's Python's tuple syntax! Run away! Run away!
>
> Seriously, having actually programmed Python for m
On Fri, Sep 20, 2002 at 02:17:42PM -0700, David Whipp wrote:
> Larry wrote:
> > : $shouldbe3 = (1,2,3) + 0;
> >
> > It's 3, though not for the reason a Perl 5 programmer would think.
> > (In Perl 6 it's the length of the anonymous array, not the
> > last value.)
>
> This kind of clever magic
On Fri, Sep 20, 2002 at 09:02:52PM -0600, John Williams wrote:
> On Fri, 20 Sep 2002, Tanton Gibbs wrote:
> > If this is the case, then can you also have:
> >
> > (,7)
> >
> > What is its length?
>
> Hmm, it's a syntax error in perl5.
I'd advocate it continuing to be a syntax error in perl 6.
On Fri, 20 Sep 2002, Tanton Gibbs wrote:
> > I believe the last two cases should be:
> >
> > (7,)== 1
> > (,) == 0
> >
> > Because its the perl6 comma that creates the list, not the parenthesis.
> >
> > ~ John Williams
>
> If this is the case, then can you also have:
>
> (,7)
>
>
According to John Williams:
> I believe the last two cases should be:
> (7,)== 1
> (,) == 0
Gack! It's Python's tuple syntax! Run away! Run away!
Seriously, having actually programmed Python for money (no smiley --
it was NOT fun), I can say that this syntactical hack would be
> > This kind of clever magic always makes me nervous:
> > it introduces subtle bug potentials.
> >
> > (7,8,9) == 3 # true
> > (7,8) == 2 # true
> > (7) == 1 # false
> > () == 0 # true?
>
> I believe the last two cases should be:
>
> (7,)== 1
> (,) == 0
>
> B
On Fri, 20 Sep 2002, David Whipp wrote:
> Larry wrote:
> > : $shouldbe3 = (1,2,3) + 0;
> >
> > It's 3, though not for the reason a Perl 5 programmer would think.
> > (In Perl 6 it's the length of the anonymous array, not the
> > last value.)
>
> This kind of clever magic always makes me nervous:
On Fri, 20 Sep 2002, Chip Salzenberg wrote:
> According to Luke Palmer:
> > I think to get Perl5 behavioueaur :), you do this:
> >
> > my @flatL = ( *("1a", "2a"), *("1b", "2b") );
>
> Geez, I hope not, because that would imply that in
>
> my @v = ( &func() );
>
> that &func is called
According to David Whipp:
> (7,8,9) == 3 # true
> (7,8) == 2 # true
> (7) == 1 # false
> () == 0 # true?
Hell, yes, why didn't I think of that? This is exactly the same
problem that afflicts Python's tuple syntax!
Larry, I strongly suggest that making () act in any way like [
Larry wrote:
> : $shouldbe3 = (1,2,3) + 0;
>
> It's 3, though not for the reason a Perl 5 programmer would think.
> (In Perl 6 it's the length of the anonymous array, not the
> last value.)
This kind of clever magic always makes me nervous:
it introduces subtle bug potentials.
(7,8,9) ==
According to Luke Palmer:
> I think to get Perl5 behavioueaur :), you do this:
>
> my @flatL = ( *("1a", "2a"), *("1b", "2b") );
Geez, I hope not, because that would imply that in
my @v = ( &func() );
that &func is called in a scalar context.
--
Chip Salzenberg - a.k.a. -
> >I was just thinking that $((1,2,3)) is also the same as [1,2,3],
> >and shorter than scalar(1,2,3).
> >
> I wonder if you can't just use $(1, 2, 3) to the same effect.
I think you can. I was under the impression that the C comma was dying,
so that would have to make a list or err.
> Al
John Williams wrote:
>On Fri, 20 Sep 2002, Larry Wall wrote:
>
>
>>On Fri, 20 Sep 2002, John Williams wrote:
>>: On Fri, 20 Sep 2002, Larry Wall wrote:
>>: >
>>: > Yes, in fact any list forced into scalar context will make a ref in Perl 6:
>>: >
>>: > $arrayref = (1,2,3);
>>:
>>: That wou
On Fri, 20 Sep 2002, Larry Wall wrote:
> On Fri, 20 Sep 2002, John Williams wrote:
> : On Fri, 20 Sep 2002, Larry Wall wrote:
> : >
> : > Yes, in fact any list forced into scalar context will make a ref in Perl 6:
> : >
> : > $arrayref = (1,2,3);
> :
> : That would seem to obviate the need for
On Fri, 20 Sep 2002, John Williams wrote:
: On Fri, 20 Sep 2002, Larry Wall wrote:
: >
: > Yes, in fact any list forced into scalar context will make a ref in Perl 6:
: >
: > $arrayref = (1,2,3);
:
: That would seem to obviate the need for brackets to define array
: references. Is there any
ters, or we have to
: > adjust all known pointers any time the string may be modified.
:
: With the current Parrot GC, keeping pointers into the string while doing
: unrelated allocation will get you a core dump, since the string body might
: be copied. So unless the regex engine copies st
On Fri, 20 Sep 2002, Larry Wall wrote:
>
> Yes, in fact any list forced into scalar context will make a ref in Perl 6:
>
> $arrayref = (1,2,3);
That would seem to obviate the need for brackets to define array
references. Is there any case where [1,2,3] would be needed instead of
(1,2,3)?
Al
y time the string may be modified.
With the current Parrot GC, keeping pointers into the string while doing
unrelated allocation will get you a core dump, since the string body might
be copied. So unless the regex engine copies strings off into its own
private non-collected storage, we're stuc
On Fri, 2002-09-20 at 10:39, Larry Wall wrote:
> On 20 Sep 2002, Aaron Sherman wrote:
> : Is that "any list" as oppopsed to "any array"? Or is that arrayref in a
> : numeric context the length of the array? In other words does this do
> : what I think I think it does?
> :
> : $shouldbe3 = (1,
On 20 Sep 2002, Aaron Sherman wrote:
: Is that "any list" as oppopsed to "any array"? Or is that arrayref in a
: numeric context the length of the array? In other words does this do
: what I think I think it does?
:
: $shouldbe3 = (1,2,3) + 0;
It's 3, though not for the reason a Perl 5 pro
On Fri, 2002-09-20 at 04:14, Larry Wall wrote:
> On 20 Sep 2002, Simon Cozens wrote:
> : > their names. also if you use a scalar to grab something which is in a
> : > quantified outer rule what is put in the var? a ref to a list of the
> : > grabbed things?
> :
> : *nod* Something I'd like to kno
On Sun, 15 Sep 2002, Steve Fink wrote:
: What should this do:
:
: my $x = "the letter x";
: print "yes" if $x =~ /the { $x .= "!" } .* !/;
Depends. I think it may be necessary for speed and safety reasons
to set COW on the string we're matching, so that you're always matching
against the or
On 20 Sep 2002, Simon Cozens wrote:
: > their names. also if you use a scalar to grab something which is in a
: > quantified outer rule what is put in the var? a ref to a list of the
: > grabbed things?
:
: *nod* Something I'd like to know.
Yes, in fact any list forced into scalar context will m
> "SC" == Simon Cozens <[EMAIL PROTECTED]> writes:
SC> [EMAIL PROTECTED] (Uri Guttman) writes:
>> actually i just had another thought. you don't need any of the $foo :=
>> stuff as the match tree will have it all for you.
SC> Yes, but it's nice to be able to access the captured thin
[EMAIL PROTECTED] (Uri Guttman) writes:
> actually i just had another thought. you don't need any of the $foo :=
> stuff as the match tree will have it all for you.
Yes, but it's nice to be able to access the captured things by
name. Or should I be saying things like
rule raiddev { *
> "SC" == Simon Cozens <[EMAIL PROTECTED]> writes:
SC> rule comm_eol { ? \n };
>>
>> aren't those 's redundant? the first is overlapping with the one at
>> the beginning of comment.
SC> But only matches if there *is* a comment, and there may not
SC> be, so I want to match opt
[EMAIL PROTECTED] (Uri Guttman) writes:
> shouldn't that have a inside the blank line?
Or *, yes.
> SC> rule comm_eol { ? \n };
>
> aren't those 's redundant? the first is overlapping with the one at
> the beginning of comment.
But only matches if there *is* a comment, and there may not
> "SC" == Simon Cozens <[EMAIL PROTECTED]> writes:
SC> raiddev /dev/md0
SC> raid-level 5
SC> option value
SC> option value
SC> ...
SC> device /dev/sde1
SC> raid-disk 0
Well, I've started my Perl 6 programming career already and I've got
stuck. :)
I'm trying to parse a Linux RAID table (/etc/raidtab), which looks a
bit like this:
raiddev /dev/md0
raid-level 5
option value
option value
On Wed, 18 Sep 2002, Luke Palmer wrote:
> On Wed, 18 Sep 2002, Josh Jore wrote:
> > On Wed, 18 Sep 2002, Damian Conway wrote:
> > > > What possible outputs are legal for this:
> > > >
> > > > "aaa" =~ /( a { print 1 } | a { print 2 })* { print "\n" } x/
> >
> > I take it that what I've learned f
Josh Jore wrote:
>>>Would it be correct for this to print 0? Would it be correct for this
>>>to print 2?
>>>
>>> my $n = 0;
>>> "aargh" =~ /a* { $n++ } aargh/;
>>> print $n;
>>
>>Yes. ;-)
>
> Wouldn't that print 2 if $n is lexical
Err. It *is* lexical in this example.
> and 0 if it's local
On Wed, 18 Sep 2002, Josh Jore wrote:
> On Wed, 18 Sep 2002, Damian Conway wrote:
>
> > > Would it be correct for this to print 0? Would it be correct for this
> > > to print 2?
> > >
> > > my $n = 0;
> > > "aargh" =~ /a* { $n++ } aargh/;
> > > print $n;
> >
> > Yes. ;-)
>
> Wouldn't that
On Wed, 18 Sep 2002, Damian Conway wrote:
> > Would it be correct for this to print 0? Would it be correct for this
> > to print 2?
> >
> > my $n = 0;
> > "aargh" =~ /a* { $n++ } aargh/;
> > print $n;
>
> Yes. ;-)
Wouldn't that print 2 if $n is lexical and 0 if it's localized? Or are
lexic
Steve Fink wrote:
> What should this do:
>
> my $x = "the letter x";
> print "yes" if $x =~ /the { $x .= "!" } .* !/;
>
> Does this print "yes"?
If it's allowed at all, I think the match should succeed.
> print "yes" if "helo" =~ /hel { .pos-- } lo/;
This definitely has to work. But r
> "AS" == Aaron Sherman <[EMAIL PROTECTED]> writes:
AS> On Mon, 2002-09-09 at 06:05, David Helgason wrote:
>>
>> Yeay! Golf...
>> If we are allowed to use all of perl6 in this particular (golf-)course,
>> I suggest:
AS> Clearly I've missed a reference at some point. Presumably
On Mon, Sep 09, 2002 at 05:02:18PM -0400, Aaron Sherman wrote:
> On Mon, 2002-09-09 at 06:05, David Helgason wrote:
> >
> > Yeay! Golf...
>
> > If we are allowed to use all of perl6 in this particular (golf-)course,
> > I suggest:
>
> Clearly I've missed a reference at some point. Presumably "
On Mon, 2002-09-09 at 06:05, David Helgason wrote:
>
> Yeay! Golf...
> If we are allowed to use all of perl6 in this particular (golf-)course,
> I suggest:
Clearly I've missed a reference at some point. Presumably "golf" is used
here to mean something like "stupid question".
> Perl6 will be a
[Moved over from p6i, to more appropriate p6l]
On Sat, 2002-09-07 at 12:03, Mr. Nobody wrote:
> While Apocolypse 5 raises some good points about problems with the old regex
> syntax, its new syntax is actually worse than in perl 5. Most regexes, such
> as this one to match
Yeay! Golf...
Adam D. Lopresto wrote:
[...golf...]
> /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/ #50 chars
[...more golf...]
> Of course, that's because we use perl6's strengths.
>
> :i/^(+|-)?(\d*[\.\d*]?)<($2=~/./)>[E([+|-]?\d+)]?$/ #51
Clever! But
If we are allowed to
antissa isn't empty, making the new perl6 code actually shorter than the
(correct) perl5 version. Of course, that's because we use perl6's strengths.
:i/^(+|-)?(\d*[\.\d*]?)<($2=~/./)>[E([+|-]?\d+)]?$/#51
> While Apocolypse 5 raises some good points about proble
On Fri, 6 Sep 2002, Mr. Nobody wrote:
> While Apocolypse 5 raises some good points about problems with the old regex
> syntax, its new syntax is actually worse than in perl 5. Most regexes, such
> as this one to match a C float
>
> /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+
should probably compare
non-capturing versions of the regex:
/^[+-]?(?=\d|\.\d)\d*(?:\.\d*)?(?:[Ee][+-]?\d+)?$/
vs
/^<[+-]>?\d*[\.\d*]?[<[Ee]><[+-]>?\d+]?$/
The <[Ee]> isn't the way I'd write it in Perl 6 -- I'd shift
into case-insensitive mode temporarily bec
While Apocolypse 5 raises some good points about problems with the old regex
syntax, its new syntax is actually worse than in perl 5. Most regexes, such
as this one to match a C float
/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/
would actually become longer:
/^(<[+-]>?)\d*(\.\d*)
On Fri, Sep 06, 2002 at 02:49:13PM +0100, Piers Cawley wrote:
> Nicholas Clark <[EMAIL PROTECTED]> writes:
> > This idea of just switching language syntax in a context-sensitive way is
> > trying to make my head explode.
>
> But you mean that in a good way right? Anyway, he did introduce the
Ye
On Fri, Sep 06, 2002 at 02:34:52PM +0100, Nicholas Clark wrote:
> On Wed, Sep 04, 2002 at 10:46:24PM -0400, Ken Fox wrote:
> > What is really needed is something that converts the date syntax
> > to normal Perl code:
> >
> >rule iso_date { () -
> >() -
> >
Nicholas Clark <[EMAIL PROTECTED]> writes:
> On Fri, Sep 06, 2002 at 02:20:10PM +0100, Piers Cawley wrote:
>> Nicholas Clark <[EMAIL PROTECTED]> writes:
>>
>> > On Wed, Sep 04, 2002 at 10:46:24PM -0400, Ken Fox wrote:
>> >> What is really needed is something that converts the date syntax
>> >> t
On Fri, Sep 06, 2002 at 02:20:10PM +0100, Piers Cawley wrote:
> Nicholas Clark <[EMAIL PROTECTED]> writes:
>
> > On Wed, Sep 04, 2002 at 10:46:24PM -0400, Ken Fox wrote:
> >> What is really needed is something that converts the date syntax
> >> to normal Perl code:
> >>
> >>rule iso_date { (
Nicholas Clark <[EMAIL PROTECTED]> writes:
> On Wed, Sep 04, 2002 at 10:46:24PM -0400, Ken Fox wrote:
>> What is really needed is something that converts the date syntax
>> to normal Perl code:
>>
>>rule iso_date { () -
>>() -
>>()
>>
On Wed, Sep 04, 2002 at 10:46:24PM -0400, Ken Fox wrote:
> What is really needed is something that converts the date syntax
> to normal Perl code:
>
>rule iso_date { () -
>() -
>()
>{ use grammar Perl::AbstractSyntax;
>
On Wed, 2002-09-04 at 22:46, Ken Fox wrote:
>rule iso_date { $year:=(\d{4}) -
>$month:=(\d{2}) -
>$day:=(\d{2}) }
You mean C<< \d<4> >>, etc. I presume.
David Whipp wrote:
> But can I use a non-constant date?
You didn't show us the iso_date rule.
> Obviously we could put the onus on the module writer to write super-flexible
> rules/grammars. But will there be an easy way to force interpolative context
> onto this type of regex-
here. I
could now write:
$foo.set_date 2002-09-04;
But can I use a non-constant date?
Perl5: $day = "04"; $foo->set_date("2002-09-$day");
Perl6: $day = "04"; $foo.set_date 2002-09-$day; # ERROR -- doesn't match
regex
Perl6: $day = "04"; eval "\$f
Piers Cawley wrote:
> If I replace C<< ($key, $val) >> with
>
> @ary = m/<$pattern>/
>
> and the match succeeds, how many elements are there in @ary?
Zero. No explicit captures in that pattern.
> Suppose you want to use a hypothetical variable to bind a name to
> a capture
Piers Cawley wrote:
> Unless I'm very much mistaken, the order of execution will
> look like:
>
> $2:=$1; $1:=$2;
You're not binding $2:=$1. You're binding $2 to the first
capture. By default $1 is also bound to the first capture.
Assuming that numbered variables aren't special, the orde
On 31 Aug 2002 at 10:26, Piers Cawley wrote:
> > my $pattern = rx:w / $1:=(\S+) = $2:=(\S+) |
> > $2:=(\S+) = $1:=(\S+) /;
>
> Count the capturing groups. Looks like there's 4 of 'em to me. $1, $2,
> $3 and $4 are automatic variables which, according to the Apocalyp
On 31 Aug 2002 at 0:17, Piers Cawley wrote:
> my $pattern = rx:w / $1:=(\S+) = $2:=(\S+) |
> $2:=(\S+) = $1:=(\S+) /;
>
> @ary = m/<$pattern>/
>
> how many elements are there in @ary? I can
> make a case for 4 quite happily. Certainly that's what A5 seems to
On Tue, 16 Jul 2002, Brent Dax wrote:
> I was reading through the Monastery, and I noticed a node (about the
> line between what's considered Perl discussion and what's off-topic)
> that had this regex in it:
>
> m:iw/how [do[es]?|can] [I|one] @tasks in @non_
I was reading through the Monastery, and I noticed a node (about the
line between what's considered Perl discussion and what's off-topic)
that had this regex in it:
m:iw/how [do[es]?|can] [I|one] @tasks in @non_perl_languages/
(Yes, people are already using Perl 6 regex
On Thu, 4 Jul 2002, Ashley Winters wrote:
: On Thursday 04 July 2002 10:47 am, Larry Wall wrote:
: > On Thu, 4 Jul 2002, Ashley Winters wrote:
: > So I'd guess that we just don't talk about :-1, but rather say that
: >
: > <*$min..$max>
: >
: > is naturally greedy, and as with any quantifier y
On Thursday 04 July 2002 11:07 am, Ashley Winters wrote:
>
> I would expect /a<*1..2>?/ to mean /[a<*1..2>]?/ just looking at it. How
> can ? ever mean non-greedy unless it follows a metachar <[*+?]>?
Perhaps I can respond to my own question. In /.+?/ . is an assertion, + is an
assertion, and ?
On Thursday 04 July 2002 10:47 am, Larry Wall wrote:
> On Thu, 4 Jul 2002, Ashley Winters wrote:
> So I'd guess that we just don't talk about :-1, but rather say that
>
> <*$min..$max>
>
> is naturally greedy, and as with any quantifier you write
>
> <*$min..$max>?
>
> to get minimal match
On Thu, 4 Jul 2002, Ashley Winters wrote:
: I was pondering how to implement the apocalypse 5 stuff (only pondering) and I
: was wondering if could be legal, indicating a greedy match.
:
: * =
: + =
: ? = <1,0>
: *? = <0,Inf>
: +? = <1,Inf>
: ?? = <0,1>
We could autoreverse, but it'd be a ba
I was pondering how to implement the apocalypse 5 stuff (only pondering) and I
was wondering if could be legal, indicating a greedy match.
* =
+ =
? = <1,0>
*? = <0,Inf>
+? = <1,Inf>
?? = <0,1>
Speaking of the range assertion, is there anything other than ? There
used to be discussion on th
On Tue, Jul 02, 2002 at 03:59:57PM -0500, Allison Randal wrote:
>
> The parens in #3, C<< <( code )> >>, make sense if you think of
s/3/2/
Allison
re what we would expect from a block than just
getting a "truth" value). Think of it as analogous to C<< <$pat> >>,
only the value of $pat is returned instead of pre-existing within a
variable.
And, C< $( code ) > fits nicely with the general (non-regex) syntax for
interpolating a scalar expression.
Allison
Current p6 rx syntax aiui regarding embedded code:
/
#1 do (may include an explicit fail):
{ code }
#2 do with implicit 'or fail'
<( code )>
#3 interp lit:
$( { code } )
#4 interp as rx:
<{ code }>
/
This feels cryptic. Do we need abbreviated syntax for
On Wed, 5 Jun 2002 [EMAIL PROTECTED] wrote:
> Just read (skimmed) apocalypse 5, had one concern - it looks like we are on a
> serious collision course with parsing the various *mls.
>
> before:
>
> m#..etc#
>
> after
>
> m#\\\#
>
> Also, the space being backslashed sort of bugs me. Surely th
after
>#
># m#\\\#
>
>That's intentional. What will that regex do with this?
>
>
>
>That's interpreted the same way, but typed a bit differently. It won't
>match your regex.
>
>The moral of the story is that you should not try to parse the *MLs with
[EMAIL PROTECTED]:
# Just read (skimmed) apocalypse 5, had one concern - it looks
# like we are on a serious collision course with parsing the
# various *mls.
#
# before:
#
# m#..etc#
#
# after
#
# m#\\\#
That's intentional. What will that regex do with this?
That's i
hmm.
Just read (skimmed) apocalypse 5, had one concern - it looks like we are on a
serious collision course with parsing the various *mls.
before:
m#..etc#
after
m#\\\#
Also, the space being backslashed sort of bugs me. Surely there is going to be
a 'non-x' modifier? And perhaps a modifier t
_ pat2 _ pat3 and capture pat2 match:
: / pat1 { ($foo) = / pat2 / } pat3 /
:
: work?
As long as they're all working off of the same regex state, I
don't see why not. Except that you'd better have a () in
pat2 to capture something, if we keep the same rules as Perl 5.
:
/ pat1 { ($foo) = / pat2 / } pat3 /
work?
> I don't think the return of the closure will be interpreted as
> [a string to be matched or a boolean success indicator or
> indeed anything, at least not something that the regex
> pays attention to]. Closures will be used for si
Me writes:
: [modified repost due to warnock's dilemma]
:
: Would something like these DWIM?
:
: # match pat1 _ pat2 and capture pat2 match:
: / pat1 { ($foo) = / pat2 / } /
Yes, though I think we'll see people doing it more like this:
/ pat1 ( pat2 ) { $foo = $-1 } /
We might al
[modified repost due to warnock's dilemma]
Would something like these DWIM?
# match pat1 _ pat2 and capture pat2 match:
/ pat1 { ($foo) = / pat2 / } /
# match pat1 _ 'foo bar':
/ pat1 { 'foo bar' } /
# match pat2 if not pat1
/ { ! /pat1/ } pat2 } /
# match pat2 if
Michael G Schwern wrote in perl.perl6.language :
> On Tue, Apr 23, 2002 at 11:11:28PM -0500, Me wrote:
>> Third, I was thinking that having perl 6 regexen have /s on
>> by default would be easy for perl 5 coders to understand;
>> not too hard to get used to; and have no negative effects
>> for exi
> when matching against something like "foo\nwiffle\nbarfoo\n"
>/(foo.*)$/ # matches the last line
/(foo[^\n]*)$/ # assuming perl 6 meaning of $, end of string
>/(foo.*)$/m # matches the first line
/(foo[^\n]*)$$/ # assuming perl 6 meaning of $$, end of line
or
/(foo.*?
101 - 200 of 251 matches
Mail list logo