Re: Loop controls

2002-04-26 Thread Tatsuhiko Miyagawa
At Fri, 26 Apr 2002 09:40:14 +0100, Andy Wardley wrote: This is an approach I've used to great effect in the Template Toolkit. In this case, the iterator controlling a 'FOREACH' loop is aliased to the 'loop' variable [% FOREACH x = y %] [% table\n IF loop.first %] tr

Re: Loop controls

2002-04-26 Thread Aaron Sherman
On Thu, 2002-04-25 at 18:20, Damian Conway wrote: Miko O'Sullivan wrote: before { ... } # run before first iteration, # only if there is at least one iteration Larry is still considering allowing a CFIRST block that would do this. [...] This will be called a

Re: Loop controls

2002-04-26 Thread Tim Bunce
On Fri, Apr 26, 2002 at 10:29:58AM -0400, Aaron Sherman wrote: On Thu, 2002-04-25 at 18:20, Damian Conway wrote: Miko O'Sullivan wrote: before { ... } # run before first iteration, # only if there is at least one iteration Larry is still considering

Re: Please rename 'but' to 'has'.

2002-04-26 Thread Dan Sugalski
At 2:26 PM +0100 4/26/02, Nicholas Clark wrote: On Tue, Apr 23, 2002 at 01:25:15PM -0400, Dan Sugalski wrote: At 12:36 PM -0400 4/23/02, Buddha Buck wrote: OK, but that limits you to the, um, 24 standard levels of precedence. What do you do if you don't think that that's enough

Re: Please rename 'but' to 'has'.

2002-04-26 Thread Tim Bunce
On Fri, Apr 26, 2002 at 11:33:06AM -0400, Dan Sugalski wrote: At 2:26 PM +0100 4/26/02, Nicholas Clark wrote: On Tue, Apr 23, 2002 at 01:25:15PM -0400, Dan Sugalski wrote: At 12:36 PM -0400 4/23/02, Buddha Buck wrote: OK, but that limits you to the, um, 24 standard levels of

Re: Loop controls

2002-04-26 Thread Allison Randal
On Fri, Apr 26, 2002 at 08:49:23AM +1000, Damian Conway wrote: Trey Harris wrote: So: for $results.get_next() { FIRST { print Results:BR; } NEXT { print HR; } } else { print No results.; } Do I have that right? Yes. Presuming Larry decides in favour of CFIRST and

Re: Please rename 'but' to 'has'.

2002-04-26 Thread Miko O'Sullivan
This is now extensible to any number of precedence levels, and you can now use simple string comparison to compare any two precedences. It even short circuits the comparison as soon as it finds a character that differs. Gee, maybe I should patent this. Too late. Amazon has already

Re: Please rename 'but' to 'has'.

2002-04-26 Thread Dan Sugalski
At 5:05 PM +0100 4/26/02, Tim Bunce wrote: On Fri, Apr 26, 2002 at 11:33:06AM -0400, Dan Sugalski wrote: At 2:26 PM +0100 4/26/02, Nicholas Clark wrote: On Tue, Apr 23, 2002 at 01:25:15PM -0400, Dan Sugalski wrote: At 12:36 PM -0400 4/23/02, Buddha Buck wrote: OK, but that limits you

Re: Please rename 'but' to 'has'.

2002-04-26 Thread Larry Wall
Tim Bunce writes: : For perl at least I thought Larry has said that you'll be able to : create new ops but only give them the same precedence as any one : of the existing ops. Close, but not quite. What I think I said was that you can't specify a raw precedence--you can only specify a

Re: Please rename 'but' to 'has'.

2002-04-26 Thread Buddha Buck
At 09:45 AM 04-26-2002 -0700, Larry Wall wrote: Tim Bunce writes: : For perl at least I thought Larry has said that you'll be able to : create new ops but only give them the same precedence as any one : of the existing ops. Close, but not quite. What I think I said was that you can't specify a

Re: Please rename 'but' to 'has'.

2002-04-26 Thread Larry Wall
Buddha Buck writes: : So you'd have something like: : : sub operator:mult($a, $b) is looser('*') is inline {...} : sub operator:add($a, $b) is tighter(+) is inline {...} : sub operator:div($a,$b) is looser(/) is inline {...} : : assuming default Perl5 precedences for *, *, and / you would have

Re: Please rename 'but' to 'has'.

2002-04-26 Thread Pixel
Larry Wall [EMAIL PROTECTED] writes: : Why not use a 16 bit int and specify that languages should use : default precedence levels spread through the range but keeping the : bottom 8 bits all zero. That gives 255 levels between '3' and '4'. : Seems like enough to me! : : Floating point

Re: Loop controls

2002-04-26 Thread Aaron Sherman
On Fri, 2002-04-26 at 14:11, Allison Randal wrote: On Fri, Apr 26, 2002 at 08:49:23AM +1000, Damian Conway wrote: Hmmm... how about: for $results.get_next() { print $_; LAST { print Done.; } ELSE { print No results.; } } The else of a loop construct isn't really the same as the

Re: Loop controls

2002-04-26 Thread Allison Randal
On Fri, Apr 26, 2002 at 05:24:13PM -0400, Aaron Sherman wrote: On Fri, 2002-04-26 at 14:11, Allison Randal wrote: The else of a loop construct isn't really the same as the else of an Cif. You can't use an Celsif for one thing. Why not? What would be wrong with: for x {

Re: Loop controls

2002-04-26 Thread Miko O'Sullivan
Of course it brings other less wholesome things to mind like elsfor and elsloop and if ... elsfor and for ... elsif ... elsloop ... else, but why not? Well, I agree with the concept, but boyoboy those names ain't gonna fly. We'll have to head down the road of unlessfor

Re: Loop controls

2002-04-26 Thread Luke Palmer
On Fri, 26 Apr 2002, Allison Randal wrote: Besides, I would expect an Celsfor to actually be a loop of it's own, on the principle of elsif = else + if so elsfor = else + for. So, you're suggesting we add Celsunless then? Just because it's possible doesn't mean it's necessary. Luke

Re: Loop controls

2002-04-26 Thread Allison Randal
On Fri, Apr 26, 2002 at 11:14:36PM -0600, Luke Palmer wrote: On Fri, 26 Apr 2002, Allison Randal wrote: Besides, I would expect an Celsfor to actually be a loop of it's own, on the principle of elsif = else + if so elsfor = else + for. So, you're suggesting we add Celsunless then? Just