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

Re: [FWP] APL vs. Perl. A query from a lazy programmer.



Ian Phillipps wrote:
> 
> The topic of APL came up today, and I recalled an APL one-liner (about
> 150 chars if I recall) that printed a set of 4 Bridge hands in the
> conventional layout.

Here's 198.  I'm sure it can be shortened/improved, but it's time for
bed.

@s=qw/S H D C/;for$s(@s){$_='AKQJT98765432';for$i(4,3,2,1){my$c;s/./
rand$i>1?$&:($c.=$&,"")/ge;($j,$f)=$i%2?($i,"%15s:%s"):(2,"%s:%-25s");
$x[$j]{$s}.=sprintf$f,$s,$c}}$,=$\="\n";print@{$_}{@s}for@x;

-- 
Rick Delaney
rick.delaney@home.com

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