perl.golf...Re: Just chipping in... by Jasper- November 23, 2007 On 23112007, Jasper <jaspermccreagmail.com> wrote:> Just thought of this.>> Probably has performance issues and is a little bit longer. Boo!>> !perl -l> $l=2pop;fork$l>$c++$_.=&39;(&39;:exit:$c--$_.=&39;)&39;:exit while$l--;print>> Doesn&39;t order correctly (it would if I added a wait), doesn&39;t print> right, but everyone loves potentially killing their machine with a> fork. Can&39;t get rid of the two exits, so there seems to be flab for> sureFlabby.http://www.nntp.perl.org/group/perl.golf/2007/11/msg2493.html Re: Just chipping in... by Daniel Tiefnig- November 23, 2007 Tuomo Salo wrote:> This one has no performance issues and is even a little bit shorter. > Yay!AND it does print lines in wrong order! :o)Doesn&39;t it It does for me.lg,danielhttp://www.nntp.perl.org/group/perl.golf/2007/11/msg2492.html Re: Just chipping in... by Jasper- November 23, 2007 On 20112007, Tuomo Salo <bassiki.fi> wrote:> This one has no performance issues and is even a little bit shorter. Yay!>> !perl -l> $r=qr(($r));map$r+$&&print,glob"(,)"x2x popJust thought of this.Probably has performance issues and is a little bit longer. Boo!!perl -l$l=2pop;fork$l>$c++$_.=&39;(&39;:exit:$c--$_.=&39;)&39;:exit while$l--;printDoesn&39;t order correctly (it would if I added a wait), doesn&39;t printright, but everyone loves potentially...http://www.nntp.perl.org/group/perl.golf/2007/11/msg2491.html Re: Just chipping in... by Tuomo Salo- November 20, 2007 This one has no performance issues and is even a little bit shorter. Yay!!perl -l$r=qr(($r));map$r+$&&print,glob"(,)"x2x pop -basshttp://www.nntp.perl.org/group/perl.golf/2007/11/msg2490.html Re: Just chipping in... by Tuomo Salo- November 20, 2007 -----BEGIN PGP SIGNED MESSAGE------ From the keyboard of Tuomo Salo (2007-11-19 17:52):> From the keyboard of Phil Carmody (2007-11-15 15:05):>> I saw this on sci.math, and thought "one liner" ;-)> > While I could not squeeze this down to a one 80 char line,Scratch that!Trading (any) performance and utility (whatsoever) for brevity, here&39;sfinally a one liner version:!perl -l$r=qr4($r)2;s$r$y42()printefor($=x=pop)2..$=Not only accomplishing the given task, this little.http://www.nntp.perl.org/group/perl.golf/2007/11/msg2489.html Re: Just chipping in... by Juho Snellman- November 20, 2007 Tuomo Salo <tuomo.saloplenware.fi> writes:> From the keyboard of Phil Carmody (2007-11-15 15:05):> > I saw this on sci.math, and thought "one liner" ;-)> > While I could not squeeze this down to a one 80 char line, there is only> one line that does not begin with a :-)> > !perl -l> $=s(.)n"$1(n"x($1=y(<$a)."$1)n"x($1=y)2<$_-1)> gefor 1..2($a=pop);printThe following is technically speaking not a one-liner, but is 80...http://www.nntp.perl.org/group/perl.golf/2007/11/msg2488.html Re: Just chipping in... by Phil Carmody- November 19, 2007 --- Tuomo Salo <tuomo.saloplenware.fi> wrote:> -----BEGIN PGP SIGNED MESSAGE-----> - From the keyboard of Phil Carmody (2007-11-15 15:05):> > I saw this on sci.math, and thought "one liner" ;-)> > While I could not squeeze this down to a one 80 char line, there is only> one line that does not begin with a :-)> > !perl -l> $=s(.)n"$1(n"x($1=y(<$a)."$1)n"x($1=y)2<$_-1)gefor1..2($a=pop);print> > I tried to do the...http://www.nntp.perl.org/group/perl.golf/2007/11/msg2487.html Re: Just chipping in... by Tuomo Salo- November 19, 2007 -----BEGIN PGP SIGNED MESSAGE------ From the keyboard of Phil Carmody (2007-11-15 15:05):> I saw this on sci.math, and thought "one liner" ;-)While I could not squeeze this down to a one 80 char line, there is onlyone line that does not begin with a :-)!perl -l$=s(.)n"$1(n"x($1=y(<$a)."$1)n"x($1=y)2<$_-1)gefor 1..2($a=pop);printI tried to do the generation by hand, implemented that method as aregex, and polished (or should I say disfigured) the result...http://www.nntp.perl.org/group/perl.golf/2007/11/msg2486.html Re: Just chipping in... by Jasper- November 15, 2007 I give up! I should learn to check before posting... This doesn&39;t workeither. It looks like it does without counting the results, though :SOn 15112007, Jasper <jaspermccreagmail.com> wrote:> On 15112007, Jasper <jaspermccreagmail.com> wrote:>> >> > $h$_=&39;()&39;x$ARGV0;> > $h$_,reversewhile s)(.)($1();> > print for sort keys %h;>> Phil points out that reverse isn&39;t actually a mirror (and scalar> reverse makes this horribly incorrect),...http://www.nntp.perl.org/group/perl.golf/2007/11/msg2485.html Re: Just chipping in... by Jasper- November 15, 2007 On 15112007, Jasper <jaspermccreagmail.com> wrote:>> $h$_=&39;()&39;x$ARGV0;> $h$_,reversewhile s)(.)($1();> print for sort keys %h;Phil points out that reverse isn&39;t actually a mirror (and scalarreverse makes this horribly incorrect), so it turns out I have to dothis in two passes.$h$_=&39;()&39;x $ARGV0;$h$_while s)(.)($1();$_=&39;()&39;x pop;$h$_while s(.))(.)($1()$2;print for sort keys %h;Hopefully someone can fix that :D-- Jasperhttp://www.nntp.perl.org/group/perl.golf/2007/11/msg2484.html |