develooper Front page | perl.fwp | Postings from April 2008

Re: YN golf

Thread Previous | Thread Next
From:
John W. Krahn
Date:
April 1, 2008 02:19
Subject:
Re: YN golf
Message ID:
20080401061707.28435.qmail@lists.develooper.com
Uri Guttman wrote:
> someone posted (and it wasn't homework) for an easy way to get all
> possible combos of YN (5 chars so 32 answers). he got some basic
> multiline answers but i think it makes for a great golf problem.
> 
> here is my first pass which i am sure can be easily bested. i haven't
> even squeezed out the white spaces but it does work.
> 
> golf away!
> 
> uri
> 
> perl -le 'print join "\n", map {tr/01/NY/; $_} map unpack( "b5", chr), 0 .. 31'

   perl -le'y/01/NY/&&print,for+map+unpack(b5,chr),0..31'



John
-- 
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

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