in reply to (Golf) ranging on alphabet

Given your input, there should be a range of "_" to "U", shouldn't there? "0" and "}" are right next to each other in your alphabet. Anyway, here's my response. I adapted my number-range regex.
# 48 * 3 = 144 chars sub GOLF { #23456789012345678901234567890123456789012345678 my$l=join'',@{+pop};my$a=pop;$l=join',',grep$l=~ s/\Q$_//g,@$a;$a={map{$$a[$_],$$a[$_+1]}0..@$a-2 };$l=~s/(.)(?:,((??{"\Q$$a{$+}"})))+/$1..$+/g;$l }

_____________________________________________________
Jeff[japhy]Pinyan: Perl, regex, and perl hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

Replies are listed 'Best First'.
Re: Re: (Golf) ranging on alphabet
by jynx (Priest) on Sep 27, 2001 at 08:46 UTC

    We can rework that slightly to remove characters, i count 136 with the same functionality (please tell me if my testing missed something :)
    #23456789012345678901234567890123456789012345678 $b=join'',@{+pop};@_=@{+pop};$a={map{$_[$_],$_ [$_+1]}0..@_-2};$_=join',',grep$b=~s/\Q$_//g, @_;s/(.)(?:,((??{"\Q$$a{$+}"})))+/$1..$+/g;$_
    Put a print instead of a $_ for that last bit and it's 139 characters...

    jynx

      This one is 127 chars. I hope it still works - if not correct me. :)
      #23456789012345678901234567890123456789012345678 $b=join'',@_={+pop};$a={map{$_[$_],$_[$_+1]}0.. @_-2};$_=join',',grep$b=~s/\Q$_//g,@_;s/(.)(?:,( (??{"\Q$$a{$+}"})))+/$1..$+/g;$_


      $§=lc(sub{}^" \6 \n");$§=~s/\(.*\)//;for(split
      ('',$§)){$/=$_;for(5..7){$/++}$:.=$/}print$:;1
        Sorry... when I ran this against the test I got back a hashref... The other 2 seem to work, though...

                        - Ant
                        - Some of my best work - Fish Dinner