Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Closest-value-in-list Golf!

by mr_mischief (Monsignor)
on May 31, 2001 at 06:55 UTC ( #84441=note: print w/ replies, xml ) Need Help??


in reply to Closest-value-in-list Golf!

Not the shortest, but this was what was obvious to me...

sub c { #_123456789_123456789_123456789_123456789_12345 $i=pop;for(@_){$c=$_ if abs$i-$c>abs$i-$_}$c }
Chris


Comment on Re: Closest-value-in-list Golf!
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2014-12-25 01:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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





    Results (159 votes), past polls