in reply to Re (tilly) 1: Closest-value-in-list Golf!
in thread Closest-value-in-list Golf!
Update:sub g {(sort{abs$a-$_[1]<=>abs$b-$_[1]}@{$_[0]})[0]} # 44 chars
fantastic - that's exactly half my originalsub g {$n=pop;(sort{abs$a-$n<=>abs$b-$n}@_)[0]} # 39 chars
"Argument is futile - you will be ignorralated!"
|
---|
Replies are listed 'Best First'. | |
---|---|
Re (tilly) 1: uneven abs!
by tilly (Archbishop) on May 29, 2001 at 20:36 UTC | |
by larryk (Friar) on May 29, 2001 at 22:57 UTC |