Not much to report; in case anyone care, my current shortest
is at end of this mail (just got rid of stupid chop and
reduced the number of parens).

Two specific sub-problems from this larger one that I am
interested in are:

1) Shortest way to delete 2nd, 4th, ... last character from
   a string known to be of even length (last char \n).
   This is the best I have come up with so far:
      s/(.)./$+/gs

2) As for 1), but also change all non-spaces to '#'.
   Here are two attempts:
      y/ /#/c;s/(.)./$+/gs
      s/(.)./$+=~$"?$":'#'/egs

Can anyone improve on these?

/-\ndrew


--current shortest--------------------------------------------
use Acme::EyeDrops qw(sightly);
my $src = <<'END_SRC_STR';
open$%;
y,!-~,#,,s,(.).,$+,gsfor@~=grep$|--,('')x18,<0>;
@;=map~~reverse,reverse@~;
map{system$^O=~Win?CLS:'clear';
($-=$_%3)||(--$|,map$_=reverse,@~,@;);
print$"x+abs($=/3*(2*$|-$-)),$_,$/for$-&1?@;:@~;
sleep!$%}$%..11
END_SRC_STR
$src =~ tr/\n//d;
my $prog = sightly( { Regex         => 1,
                      Compact       => 1,
                      Shape         => 'camel',
                      SourceString  => $src } );
my @a = split(/\n/, $prog);
my $max = 0; length > $max and $max = length for @a;
$_ .= ' ' x ($max - length) for @a;
print " $_ \n" for @a;

Note: '!$%' is "shorter" than ' 1' because, after sightly-
encoding, ' 1' becomes: ('{'^'[').('^'^('`'|'/'))

Reply via email to