develooper Front page | perl.golf | Postings from November 2007

Re: Just chipping in...

Thread Previous | Thread Next
From:
Jasper
Date:
November 23, 2007 08:17
Subject:
Re: Just chipping in...
Message ID:
81cd84130711230816l55b6590dp7bcdaebcfb3b373b@mail.gmail.com
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

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