Re: &, &&, and backtracking.

2007-09-06 Thread Larry Wall
On Thu, Sep 06, 2007 at 03:49:42PM -0700, Larry Wall wrote: : On Thu, Sep 06, 2007 at 04:02:19PM -0500, Patrick R. Michaud wrote: : : I agree. One thought I had was that perhaps non-greedy matching : : could also terminate the token prefix. : : Well, that's more or less arguing it the other way.

Re: &, &&, and backtracking.

2007-09-06 Thread Larry Wall
On Thu, Sep 06, 2007 at 04:02:19PM -0500, Patrick R. Michaud wrote: : I agree. One thought I had was that perhaps non-greedy matching : could also terminate the token prefix. Well, that's more or less arguing it the other way. It kind of assumes your fooba-ish arguments are smart enough to test

Re: &, &&, and backtracking.

2007-09-06 Thread Patrick R. Michaud
On Thu, Sep 06, 2007 at 12:37:37PM -0700, Larry Wall wrote: > On Thu, Sep 06, 2007 at 01:25:12PM -0500, Patrick R. Michaud wrote: > : On a somewhat similar question, what happens with a pattern > : such as > : > : "foobar" ~~ / foo.+? | fooba / > : > : The LHS initially matches "foob", but wi

Re: &, &&, and backtracking.

2007-09-06 Thread Geoffrey Broadwell
On Thu, 2007-09-06 at 12:37 -0700, Larry Wall wrote: > Yow. ICATBW. The what now? -'f

Re: &, &&, and backtracking.

2007-09-06 Thread Larry Wall
On Thu, Sep 06, 2007 at 01:25:12PM -0500, Patrick R. Michaud wrote: : > Were we using the procedural conjunction: : > : > "foobar" ~~ / <[a..z]>+ && [ ... ] /; : > : > I would guess that the LHS matches as much as it can ("foobar"), then : > the RHS matches "foo" [...and then backtracks the L

Re: &, &&, and backtracking.

2007-09-06 Thread Patrick R. Michaud
compiler and/or the run-time system to decide which parts to evaluate first, and it is erroneous to assume either order happens consistently. The && form guarantees left-to-right order, and backtracking makes the right argument vary faster than the left. So, to answe

Re: &, &&, and backtracking.

2007-09-06 Thread Jonathan Lang
Jonathan Scott Duff wrote: > How do C<&> and C<&&> differ with respect to backtracking? For instance, > > "foobar" ~~ / <[a..z]>+ & [ ... ] /; > > Both sides of the C<&> happen in parallel, so I would guess that they > both match "foo" then stop. Please correct me if that's wrong. As written,

&, &&, and backtracking.

2007-09-06 Thread Jonathan Scott Duff
How do C<&> and C<&&> differ with respect to backtracking? For instance, "foobar" ~~ / <[a..z]>+ & [ ... ] /; Both sides of the C<&> happen in parallel, so I would guess that they both match "foo" then stop. Please correct me if that's wrong. Were we using the procedural conjunction: "