En op 21 oktober 2002 sprak Gareth McCaughan:
> I'm feeling very dim. What's wrong with the much simpler
>
> sub subst { (my $a=shift) =~ s/\$\d+/eval$&/eg; $a; }
You have to replace '$1' by the actual value of $1. If you try that with
a regex, $1 is changed. In your case, $1 (and $2, $3 etc.
En op zeventien oktober tweeduizendtwee sprak (-ugene:
> So what rule are they using to score their solutions?
I don't know. The arbiter in this game is mjd and he has yet to
deliver a verdict. If I were arbiter, however, I would declare the
winner without hesitation as Eugene van der Pijll, with (
En op 21 oktober 2002 sprak Geoff Hubbard:
> Anything wrong with:
>
> sub subst{eval"\"$_[0]\""}
1) It has 3 too many strokes: eval"\"@_\""
2) It mangles $x say, in original string. As stated in original
specification (in Note: line at end), it should not do that.
/-\
http://careers.yahoo.c
On Monday 21 October 2002 7:56 pm, you wrote:
> En op 21 oktober 2002 sprak Gareth McCaughan:
> > I'm feeling very dim. What's wrong with the much simpler
> >
> > sub subst { (my $a=shift) =~ s/\$\d+/eval$&/eg; $a; }
>
> You have to replace '$1' by the actual value of $1. If you try that
> with
On Mon, Oct 21, 2002 at 05:14:49PM +1000, Andrew Savige wrote:
>
> It may be too soon to start golfing this, but a more normal
> interpretation of (-ugene's brilliancy is something like:
>
> sub subst{join'',map--$|?$_:eval,split/(\$\d+)/,$_[$|=0]}
>
> if you allow the subroutine to mangle $| (ad
En op 22 oktober 2002 sprak Gareth McCaughan:
> What's particularly embarrassing is that I *tested* it.
> How could that possibly have worked, I hear you ask?
> Simple. Excerpt from my little test program:
>
> print subst("$2, $1 and $3"), "\n";
My fault. I cut and pasted the original problem
Hello All
We started 2 new golfs yesterday, "Modular Fibonacci" and "Go golf".
"Modular Fibonacci" : http://terje.dev.webon.net/golf/?12
"Go golf" : http://terje.dev.webon.net/golf/?11
"Go golf" was supposed to be a midi golf, but looking at the leaderboard, it sure
looks like a minigolf :)
Te