Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: mini-golf: convert integer into list of powers of two

by Jenda (Abbot)
on May 24, 2012 at 09:19 UTC ( #972210=note: print w/replies, xml ) Need Help??


in reply to mini-golf: convert integer into list of powers of two

31

(on a 32 bit perl only the first 31 bits may be used, on a 64 bit one, it's the first 63. I can't tell perl the number is unsigned.

Jenda
Enoch was right!
Enjoy the last years of Rome.

Replies are listed 'Best First'.
Re^2: mini-golf: convert integer into list of powers of two
by tobyink (Canon) on May 24, 2012 at 12:30 UTC

    That's 32 by my reckoning...

    Using the assign-within-grep trick I applied to BrowserUK's solution, it is possible to take it down to 31 though:

    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2021-05-17 23:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (170 votes). Check out past polls.

    Notices?