in reply to Re: Closest-value-in-list Golf!
in thread Closest-value-in-list Golf!
is too much, since $a<=>$b is the default sort. that leaves you withsort{$a<=>$b}keys%h
for 52.sub g {$n=pop;$h{abs($_-$n)}=$_ for@_;$h{(sort keys%h)[0]}}
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: (boo)Re: Re: Closest-value-in-list Golf -- or, a sorted affair.
by larryk (Friar) on May 29, 2001 at 18:47 UTC | |
Re: (boo)Re: Re: Closest-value-in-list Golf -- or, a sorted affair.
by suaveant (Parson) on May 29, 2001 at 18:50 UTC | |
by boo_radley (Parson) on May 29, 2001 at 19:00 UTC | |
by suaveant (Parson) on May 29, 2001 at 19:10 UTC |