develooper Front page | perl.fwp | Postings from January 2002

Re: even.pl solutions

Thread Previous | Thread Next
From:
Stephen Turner
Date:
January 29, 2002 03:12
Subject:
Re: even.pl solutions
Message ID:
Pine.LNX.3.96.1020129111019.2458A-100000@gentoo
On Tue, 29 Jan 2002, Peter Makholm wrote:

> Stephen Turner <sret1@ntlworld.com> writes:
> 
> > Oh, also 7-9*index instead of 4*2**index loses a stroke and passes the test
> > suite but doesn't solve the problem. (In a mail to Andrew, I called this my
> 
> You didn't try do something like '1<<index' which would save you 2
> chars but then you had to do some shifting on the $. part too so might
> sum up.

Or 4<<index. I didn't think of that either, and should have done. But it
doesn't seem to work. index can be -1, and 4<<(-1) seems to give 0. Of
course, 2<<(index+1) is too long.

-- 
Stephen Turner, Cambridge, UK    http://homepage.ntlworld.com/adelie/stephen/
"This is Henman's 8th Wimbledon, and he's only lost 7 matches." BBC, 2/Jul/01


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