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.
In reply to andye Re: "Countdown" (golf)
by andye
in thread "Countdown" (golf)
by stuffy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |