in reply to (Golf) Friday Golf: Print Formatted Sequence of Digits

25
perl -e"printf'%03d 'x18 .$/,2..20"


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
If I understand your problem, I can solve it! Of course, the same can be said for you.

  • Comment on Re: (Golf) Friday Golf: Print Formatted Sequence of Digits(25?)

Replies are listed 'Best First'.
Re: Re: (Golf) Friday Golf: Print Formatted Sequence of Digits(25?)
by Mr. Muskrat (Canon) on Aug 14, 2003 at 19:28 UTC

    I'm sure that you meant:
    perl -e"printf'%03d 'x19 .$/,2..20"

    By the way, it's 26 unless you started counting with 0.

Re: Re: (Golf) Friday Golf: Print Formatted Sequence of Digits(25?)
by sauoq (Abbot) on Aug 14, 2003 at 19:30 UTC
    25

    Have you miscounted? I count that as 26 between the quotes... you should really count your switches though. So, I'd give that a 30.

    And I'm up two strokes with 28. :-P

    (Or, we are at 28 27 and 26 25¹ repectively if we put our solutions in files to avoid problems that result from quoting on different platforms.)

    And it would be 24 but I think -l is warranted! :-)

    -sauoq
    "My two cents aren't worth a dime.";
    
Re: Re: (Golf) Friday Golf: Print Formatted Sequence of Digits(25?)
by hardburn (Abbot) on Aug 14, 2003 at 19:18 UTC

    Don't mind that thumping sound in the background--that's just my head slamming against the monitor, saying "Why didn't I think of that?" :)

    ----
    I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
    -- Schemer

    Note: All code is untested, unless otherwise stated

Re: Re: (Golf) Friday Golf: Print Formatted Sequence of Digits(25?)
by Jenda (Abbot) on Aug 18, 2003 at 18:03 UTC

    I'm not sure this is a correct solution. The original printed a newline at the end, your version prints a space.

    Jenda
    Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
       -- Rick Osborne

    Edit by castaway: Closed small tag in signature