From: Uri Guttman <[EMAIL PROTECTED]>
Date: Thu, 10 Oct 2002 04:10:38 -0400
minor golf improvements.
Amazing how many strokes you can save by letting it sit around for a while.
KG> eval($_)==2002 && print "$_\n"
KG> for build(qw(1 2 3 4 5 6 7 8 9));
build 1 .. 9
Yep. That was boneheaded of me. Remembering the -l option also helps
(as you also found).
this is almost one line now.
perl -le'sub b{my $n=pop;@_?map{("$_$n","$_+$n","$_*$n")}b(@_):$n}eval==2002&&print
for b 1..9'
I've tried unrolling the recursion:
perl -le'@b=(1);for$n(2..9){@b=map{($_.$n,"$_+$n","$_*$n")}@b}eval==2002&&print for@b'
Which gets the code string below 80 characters.
--kag
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm