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

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



Today around 6:14pm, Casey R. Tweten hammered out this masterpiece:

: Today around 6:10pm, Casey R. Tweten hammered out this masterpiece:
: 
: : @s=qw(S H D C);
: : $c=join'',@c=(qw(A K Q J T),reverse(1..9));
: 
: So what, I have a card named '1'.  Just back off ;-)
: The rest of the code will work correctly if the above is fixed.

New version:

#!/usr/bin/perl -l
@s=qw(S H D C);$c=join'',@c=(qw(A K Q J T),reverse(2..9));
@d=sort{rand()<=>rand}map{$s=$_;map{[$s,$_]}@c}@s;
sub h{"$_: ".join'',sort{index($c,$a)<=>index$c,$b}@_}
for$p(1..4){push@{$h{$p}{$_->[0]}},$_->[1]for@d[13*$p-14..13*$p-2];
$p==3?print map{h(@{$h{$p-1}{$_}}).(' 'x(21-@{$h{$p-1}{$_}})).
h(@{$h{$p}{$_}}).$\}@s:print map{(' 'x13).h(@{$h{$p}{$_}}).$\}@s if$p!=2}


-- 
print(join(' ', qw(Casey R. Tweten)));my $sig={mail=>'crt@kiski.net',site=>
'http://home.kiski.net/~crt'};print "\n",'.'x(length($sig->{site})+6),"\n";
print map{$_.': '.$sig->{$_}."\n"}sort{$sig->{$a}cmp$sig->{$b}}keys%{$sig};
my $VERSION = '0.01'; #'patched' by Jerrad Pierce <belg4mit at MIT dot EDU>


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