in reply to "Countdown" (golf)
37 characters! I'm pleased with my first try at golfing. ;)# 1 2 3 #234567890123456789012345678901234567 $"='';grep{/^(([@_])(?!.*\2))+$/}<D>;
andy.
PS stuffy, good choice of puzzle! There went my lunchtime.
update: 36
update 2: Thanks dragonchild, 35 w/out the ;#234567890123456789012345678901234567 $"='';grep/^(([@_])(?!.*\2))+$/,<D>;
update, later:
This cope with duplicates, but is a lot longer:
(you need to use re 'eval')# 1 2 3 4 5 6 7 + 8 #234567890123456789012345678901234567890123456789012345678901234567890 +12345678901 $"='';$n{$_}++for@_;grep/^((??{"([@_])"})(??{"(?!([^$1 ]*$1){$n{$1},}) +"}))+$/,<D>
(the difference being that @_ is interpolated normally here), but for some reason this isn't allowed - I get back Eval-group in insecure regular expression in regex - no idea why, since I'm using re 'eval', and @_ surely can't be tainted?$"='';$n{$_}++for@_;grep/^(([@_])(??{"(?!([^$1 ]*$1){$n{$1},})"}))+$/, +<D>
Going to dinner. andy.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: andye Re: "Countdown" (golf)
by dragonchild (Archbishop) on Nov 30, 2001 at 18:41 UTC | |
by $code or die (Deacon) on Nov 30, 2001 at 20:46 UTC | |
|
Re: andye Re: "Countdown" (golf)
by blakem (Monsignor) on Dec 01, 2001 at 06:20 UTC | |
by andye (Curate) on Dec 01, 2001 at 15:07 UTC | |
|
Re: andye Re: "Countdown" (golf)
by dragonchild (Archbishop) on Dec 01, 2001 at 01:45 UTC |