Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re (tilly) 1: (Golf) Nearest Neighbors

by tilly (Archbishop)
on Apr 05, 2001 at 00:29 UTC ( #69875=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub nn {
    my@x=@_[0,1];@_=sort{abs$x[0]-$x[1]<abs$a-$b or@x=($a,$b);$a<=>$b}@_;@
    +x
    }
    
  2. or download this
    sub nn {
    ()=sort{abs$_[0]-$_[1]<abs$a-$b or@_=($a,$b);$a<=>$b}@_;@_
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://69875]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2014-12-29 00:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (183 votes), past polls