[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

RE: [FWP] Golf (7 strokes is par!)



> From: Ilmari Karonen [mailto:iltzu@sci.fi]
> Sent: Monday, May 01, 2000 11:23
> To: Ariel Scolnicov
> Cc: fwp@technofile.org
> Subject: Re: [FWP] Golf (7 strokes is par!)
>
> On 1 May 2000, Ariel Scolnicov wrote:
> > Jeff Pinyan <jeffp@crusoe.net> writes:
> > > Challenge: determine if $_ is an integral power of 2
> (1,2,4,8,16,...)
> > > I have it down to 7 characters.  Can anyone beat that?
> >
> > print"$_ is a power of 2"unless$_&$_-1;
>
> Another answer with 7 strokes: $_&~-$_

I just posted a long article to c.l.p.misc and c.l.p.moderated, stating
why I think this expression may be ambiguous.

--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com



==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe