develooper Front page | perl.golf | Postings from March 2008

Re: Just chipping in...

Thread Previous | Thread Next
From:
Jasper
Date:
March 31, 2008 07:27
Subject:
Re: Just chipping in...
Message ID:
81cd84130803310727o5948ffd7hde7cba6d757847be@mail.gmail.com
if anyone is still listening (ha) - someone reminded me of this last
week, so I spent another 10 minutes looking at it.

#!perl -l
eval'$c-=fork?$c?s//(/:exit:- s//)/;'x2x pop or print

is the shortest I can get with this forking method, which still prints
the results in a random order, but it's shorter than bass's.

Jasper

On 23/11/2007, Jasper <jaspermccrea@gmail.com> wrote:
> On 23/11/2007, Jasper <jaspermccrea@gmail.com> wrote:
>
>  > Just thought of this.
>  >
>  > Probably has performance issues and is a little bit longer. Boo!
>  >
>  > #!perl -l
>  > $l=2*pop;fork?$l>$c++?$_.='(':exit:$c--?$_.=')':exit while$l--;print
>  >
>  > Doesn't order correctly (it would if I added a wait), doesn't print
>  > right, but everyone loves potentially killing their machine with a
>  > fork. Can't get rid of the two exits, so there seems to be flab for
>  > sure
>
>
> Flabby indeed
>
>  #!perl -l
>  $_.=fork?$c--?')':exit:++$c&&'('for($_)x(2*pop);$c||print
>
>  That's the same length as bass, but still with the same problems. A
>  waitpid does solve the ordering problem, but the only way to stop the
>  overall parent exiting before all the permutations have printed is to
>  do something awful. Those solutions add lotsa characters... :(
>
>  --
>
> Jasper
>


-- 
Jasper

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About