[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] perlgolf - vowel sort



On Wed, Oct 18, 2000 at 08:56:50PM -0400, Keith Calvert Ivey wrote:
> I've beaten the current best hole 6 solution by two strokes, 
> unless I've missed something:

> My initial answer, which uses the empty regex pattern:
> 
>     sub hole {sort{($a=~/[aeiou]/g)[0]cmp($b=~//g)[0]}@_}
> 
> After looking at the solutions (which didn't help much), I 
> refined it down to 36 strokes:
> 
>     sub hole {sort{$a=~/[aeiou]/.$&cmp$b=~//.$&}@_}

Looks good!  The use of the empty regex pattern is very clever.  I did it
the hard way in the 47-character solution.


Keep shortening those solutions, everyone!


Ronald

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe