En op 08 juni 2002 sprak Stephen Turner:
> On Sat, 8 Jun 2002, Stephen Turner wrote:
> 
> > Well, you've all very sweetly waited until I woke up before starting the
> > discussion. I'm going to thank you by annotating the top 12 solutions for
> > you (10 veterans and 2 beginners). 
> 
> OK, here they are. See attachment (hopefully this won't mess up special
> characters).

Thanks, Stephen. The number of different approaches used by the top
golfers is amazing. I wouldn't have thought of most of them, so I guess
it's just luck that I chose the route that led to second best.

> Eugene 151.23

> #############################################################################
> #!perl -ap056
> 
> sub t{lc=~y/aeiouy//.v47.s//$&/g}
> # A subroutine to calculate the statistic. v47 is the same as '/' but has
> # better tie break score.

You left out the best part, IMHO. Look at the substitution. It has an
empty regex, which means it uses the last successful regex. This is a
perl feature of doubtful value, which will be removed in Perl6. And it's
the first time I've ever used it. The last successful regex is of course
/\w/.
 
> ":    @F
> ${\t}:        @z
> ";
> # The rest of the answer. ${\t} calculates the statistic again, for the whole
> # line.

And this could have been written as 

":      @F
".t.":  @z
";

for the same score, so the tricky scalar interpolation here is totally
unnecessary.

> s/(   .{57})...+(.
> .*    .{0,56}\S+).*/$1..$2/
> # We've still got the problem that the line can be too long. If it is, just
> # use the first 57 characters of the top line, and whichever statistics in
> # the bottom line start before that character.

And this is the part which I tried to improve until the last moment. I
was sure that if Ton had the same solution as me, his one stroke lead
would be in this regex.

In the end, it turned out that Ton had a completely different solution.
Thank goodness. I would have hated it if I had overlooked a simple 1
stroke improvement.

Ton, congratulations!

And many thanks to the refs!

(-ugene

-- 
To write is to delete. -- (,odfried |3omans

Reply via email to