On 15/11/2007, Jasper <[EMAIL PROTECTED]> wrote:
> On 15/11/2007, Jasper <[EMAIL PROTECTED]> wrote:
> > On 15/11/2007, Phil Carmody <[EMAIL PROTECTED]> 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{$_='()'x$ARGV[0]};
> while(/\)\(/){
>   s/\)(.*?)\(/$1()/;
>   \$h{$_,reverse};
> }
> print for sort keys %h;

Should read:

\$h{$_='()'x$ARGV[0]};
\$h{$_,reverse}while s/\)(.*?)\(/$1()/;
print for sort keys %h;

of course!


-- 
Jasper

Reply via email to