Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re^2: Using the olde times internet

by Anonymous Monk
on Mar 08, 2016 at 15:42 UTC ( #1157091=note: print w/replies, xml ) Need Help??

in reply to Re: Using the olde times internet
in thread Using the olde times internet

oiskuus last variant is 87 bytes long:

s!.!sprintf("%b ",2+index"etianmsurwdkgohvflpjbxcyzq",lc$&)=~s/.//r=~y/01/.-/r!ge

By assigning to $_, we can scrap the parentheses and the two =~, saving two bytes:

s!.!$_=sprintf"%b ",2+index"etianmsurwdkgohvflpjbxcyzq",lc$&;s/.//;y/01/.-/r!ge

Dropping the support for diacritics (only , and where supported anyway) easily saves another five bytes:

s!.!$_=sprintf"%b ",2+index etianmsurwdkgohvfXlXpjbxcyzq,lc$&;s/.//;y/01/.-/r!ge

With some shuffling around, we can shave off another byte: (note that this version prints a leading whitespace, while the previous ones printed a trailing whitespace)

s!.!sprintf" %b",2+index etianmsurwdkgohvfXlXpjbxcyzq,lc$&!ge;s/ ./ /g;y/01/.-/

Using a regex instead of index saves yet another byte, now down to 78:

s!.!XetianmsurwdkgohvfXlXpjbxcyzq=~lc$&;sprintf" %b","@+"!ge;s/ ./ /g;y/01/.-/

Finally, heres a 87 bytes variant that doesnt require the -p flag. Its longer by StackExchanges standard (where -p counts as a single additional byte), but shorter for, where you would have to write the entire 10-byte shebang line.

print+sprintf("%b ","@+")=~s/.//r=~y/01/.-/rwhile-etianmsurwdkgohvfXlXpjbxcyzq=~lc getc

I think theres still room for improvement.

Replies are listed 'Best First'.
Re^3: Using the olde times internet
by Grimy (Pilgrim) on Mar 08, 2016 at 15:43 UTC
    I accidentally posted the above as an Anonymous Monk, and now I cant edit it to fix the glaring typo :/

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2017-12-17 20:41 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (466 votes). Check out past polls.