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

Re: YN golf

Thread Previous | Thread Next
April 11, 2008 06:10
Re: YN golf
Message ID:
From the keyboard of Uri Guttman [31.03.08,17:50]:

> 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'

from mtve:

  perl -le 'y/12/NY/-5||print for 0..2x5'

(can't do any better...)


_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About