in reply to Time to golf

Here is miranda:

socket S,2,1,0;connect S,pack sa14,2,"\nD\321:\226\231";$/=!print S"D ! @ARGV\nQ\n";print<S>=~/51.*?^(.*?)^\./sm

Counting your grep at 65 chars, i propose this sligtly cheating 53:

-n0 "@a[$|.($x-6)..$x+++3]"=~TEST&&print for@a=/.*\n/g

Also, about your 'ark', will following work?

perl -pe's/(.* )(.*)/$2+0?$$1=$&:$$1/e'

Replies are listed 'Best First'.
Re: Re: Time to golf
by xmath (Hermit) on Feb 21, 2003 at 22:51 UTC
    Miranda: yours doesn't work - hangs forever because you don't auto-flush. (might be platform-dependent)

    grep: Using your count, mine would be 64 actually.

    In any case, yes what you're doing is majorly cheating. The script should work streaming, and you should use /TEST/ since the pattern is supposed to be replacable

    Other than that however it is fairly nice.

    The ark version certainly works, and beats my original by one char. Unfortunately for you, it inspired me to an even shorter one:

    perl -pe's/(.* )(.*)/-$2?$$1=$&:$$1/e'
    So, your turn again :-)

      Ah, yep, you're right about miranda, i noticed that.

      What regarding to ark, not so easy :)

      -p s/\S*$/-$&?${$`}=$&:${$`}/e

        -p s/ .*/-$&?${$`}=$&:${$`}/e

        •Update: forget I said this.. it opens possibility for messing up special vars

        •Update: looks like you've won on this one, damn congratulations :-)