Search   Feed   Browse   Add
Feed items 11 - 15 of 15 for November 2007

perl.golf

...

Re: Just chipping in... by Jasvir Nagra - November 15, 2007

To golf it a little to make it into an actual one-liner (even if arather long one!)!usrbinperl -l$n=pop;$"=$;print"w($n)";subwmy($n)=pop;!$n_="":$n==1_="()":a;if($n>1)for$k(0..--$n)for$p(w($k))push_,"($p)$_"forw($n-$k)_-- jasOn Nov 15, 2007 2:05 PM, Phil Carmody <thefatphilyahoo.co.uk> wrote:> I saw this on sci.math, and thought "one liner" ;-)> I even think a DP non-recursive approach should be quite quick.> Keeping the...
http://www.nntp.perl.org/group/perl.golf/2007/11/msg2483.html

Re: Just chipping in... by Jasper - November 15, 2007

On 15112007, Jasper <jaspermccreagmail.com> wrote:> On 15112007, Jasper <jaspermccreagmail.com> wrote:> > On 15112007, Phil Carmody <thefatphilyahoo.co.uk> wrote:> > > I saw this on sci.math, and thought "one liner" ;-)> > > I even think a DP non-recursive approach should be quite quick.> > > Keeping the output in the logical order might cost a few strokes.> >>> and (mostly) with a regex :):wq>>...
http://www.nntp.perl.org/group/perl.golf/2007/11/msg2482.html

Re: Just chipping in... by Jasper - November 15, 2007

On 15112007, Jasper <jaspermccreagmail.com> wrote:> On 15112007, Phil Carmody <thefatphilyahoo.co.uk> wrote:> > I saw this on sci.math, and thought "one liner" ;-)> > I even think a DP non-recursive approach should be quite quick.> > Keeping the output in the logical order might cost a few strokes.>and (mostly) with a regex :):wq$h$_=&39;()&39;x$ARGV0;while()() s)(.)($1(); $h$_,reverse;print for sort keys %h;-- Jasper
http://www.nntp.perl.org/group/perl.golf/2007/11/msg2481.html

Re: Just chipping in... by Jasper - November 15, 2007

On 15112007, Phil Carmody <thefatphilyahoo.co.uk> wrote:> I saw this on sci.math, and thought "one liner" ;-)> I even think a DP non-recursive approach should be quite quick.> Keeping the output in the logical order might cost a few strokes.First pass:sub f my($i,$c,p)=_; $i mapf($i-1,$c+(-),p,$_)!$c&39;(&39;:$c-$iqw) (:&39;)&39;: print join&39;&39;,pf($ARGV02);I suppose that will give an undef for 0...-- Jasper
http://www.nntp.perl.org/group/perl.golf/2007/11/msg2480.html

Just chipping in... by Phil Carmody - November 15, 2007

I saw this on sci.math, and thought "one liner" ;-)I even think a DP non-recursive approach should be quite quick.Keeping the output in the logical order might cost a few strokes.!usrbinperl$count = $ARGV0;print join "n", pren($count), "";sub pren my list = (); (my $n) = _; if ($n == 0) push(list, "") elsif($n == 1) push(list, "()") elsif($n > 1) foreach $k (0 .. $n-1) foreach $p1 (pren($k)) .
http://www.nntp.perl.org/group/perl.golf/2007/11/msg2479.html
Available Archives
- February (2 items)
- June (9 items)
- July (1 item)
- November (15 items)
Sponsored Links
© 2008 FeedCapsule.com  |  Contact