sub nn2 { my$s=sub{sort{$a<=>$b}keys%_}; @_{@_}=0;@_=&$s;%_=(); $_{abs($_[$_]-$_[$_+1])}=[@_[$_,$_+1]]for 0..$#_; @{$_{(&$s)[0]}} }
Neat problem!
In reply to Re: (Golf) Nearest Neighbors
by satchboost
in thread (Golf) Nearest Neighbors
by MeowChow
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |