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

Re: Re (tilly) 1: (Golf) Nearest Neighbors

by petral (Curate)
on Apr 06, 2001 at 08:34 UTC ( #70397=note: print w/replies, xml ) Need Help??

in reply to Re (tilly) 1: (Golf) Nearest Neighbors
in thread (Golf) Nearest Neighbors

OK, a couple of simple typographic manipulations to bring it to 55:
sub nn { ()=sort{abs$a-$b>abs$_[0]-$_[1]or@_=($a,$b);$a-$b}@_;@_ }
(There are advantages to being slow (or having no time!)).  I was still up over 80 strokes with my sort-based solution when I looked up and saw this guy casually strolling past Tiger Woods.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://70397]
marto has a similar idea on the 'to do' list
[Discipulus]: 65-35 joint venture marto? ;=)
[choroba]: Fibonacci at 34!
[marto]: Discipulus, what did you have in mind?
[marto]: sort of related, have you seen sonic pi
[Discipulus]: choroba less than perl -le ' $==1,(1 x $_)=~/(^)(1|11\1 )*(?{$=++})^/, print $= for 0..10'?? congrats
[Discipulus]: marto i had in mind something for stupid peoples with smart phones; a free app (this is the the non perl part..) and some hardware to sell in big cities

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (10)
As of 2017-10-17 10:04 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (225 votes). Check out past polls.