Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Decimal Gray Code in 31 chars

by ikegami (Pope)
on Jan 18, 2010 at 22:25 UTC ( #818062=note: print w/replies, xml ) Need Help??


in reply to Decimal Gray Code in 31 chars

From your 35

perl -e'print(($_^$_>>1).$/)for(0..pop)' 15 12345678901234567890123456789012345

I shave 6 off

perl -le'print$_^$_>>1 for 0..pop' 15 12345678901234567890123456789

3 more if 5.10+

perl -E'say$_^$_>>1 for 0..pop' 15 12345678901234567890123456

Replies are listed 'Best First'.
Re^2: Decimal Gray Code in 31 chars
by mtve (Deacon) on Jan 19, 2010 at 10:46 UTC

    two more:

    print$_^$_/2for 0..pop
      I swear I tried removing that space and got an error. But yeah, it works.
Re^2: Decimal Gray Code in 31 chars
by ambrus (Abbot) on Jan 19, 2010 at 11:13 UTC

    It's funny how some people still post nodes with such titles despite the warning on the top of Obfuscated code: Word of warning, though: Don't be too cocky with your post almost inevitably someone will post a reply that does the exact same thing in even fewer characters!

      My guess is because by saying "simplest as possible", it challenges others to improve on it ;). Do you think this many comments would be gathered otherwise?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://818062]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2018-07-20 07:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (426 votes). Check out past polls.

    Notices?