Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: (boo) Re: Closest-value-in-list Golf!

by suaveant (Parson)
on May 29, 2001 at 18:30 UTC ( #83944=note: print w/ replies, xml ) Need Help??

in reply to (boo) Re: Closest-value-in-list Golf!
in thread Closest-value-in-list Golf!

even shorter to not assign to @s at all, like my Update2
                - Ant

Comment on Re: (boo) Re: Closest-value-in-list Golf!
Replies are listed 'Best First'.
Re: Re: (boo) Re: Closest-value-in-list Golf!
by larryk (Friar) on May 29, 2001 at 18:37 UTC
    sub g {$n=pop;$h{abs$_-$n}=$_ for@_;$h{(sort{$a<=>$b}keys%h)[0]}}

    57 if you take out the ( ) on the abs

    "Argument is futile - you will be ignorralated!"

      oooooohh... ++
                      - Ant

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2016-02-13 01:08 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (415 votes), past polls