Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Re: (Golf) Nearest Neighbors

by thospel (Hermit)
on Oct 27, 2003 at 19:28 UTC ( #302483=note: print w/ replies, xml ) Need Help??


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

Just saw this thread. Here is a destructive (only works once) solution at 46:

sub nn{$a|=$"x$_.1for@_;$b.=$"until$a=~/1$b(1)/;@a=@-}


Comment on Re: Re: (Golf) Nearest Neighbors
Download Code
Re: Re: Re: (Golf) Nearest Neighbors
by thospel (Hermit) on Oct 27, 2003 at 19:34 UTC
    Ah, I should think a bit more before submitting. Here is a 44 (and I should also mention it only works for smallish natural numbers, all different and at least 2 arguments):

    sub nn{$a|=2x$_.3for@_;$b.=2until$a=~/3$b(3)/;@a=@-}

    The need for the assign is a perlbug, otherwise it would be 41

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2014-11-22 05:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (118 votes), past polls