develooper Front page | | Postings from July 2002

Re: Golf this.

Thread Previous | Thread Next
Michael W Thelen
July 16, 2002 13:58
Re: Golf this.
Message ID:
On Tue, Jul 16, 2002 at 08:50:14PM +0000, Ton Hospel wrote:
> > Here's a 20 that looks like it still has room for improvement:
> > 
> > 20 \@h{<>},print sort%h
> > 
> Mm, interesting generally useful technique. I think you have just become
> inventor of something that will soon be a standard golfing trick (e.g.
> it makes the 95 in the tortoise discussion into a 94).

Yay!  I always wanted to do that.  Actually, it's funny that I was able to do
it now... during TPR(0,4), I wanted to do exactly this (create hash keys with
undef values using a hash slice), but I wasn't able to come up with this little
reference trick.

Now if only I could get rid of the space in that 20 solution.  I've come up
with a couple other 20s:

20 print\@h{<>}&&sort%h
20 print!\@h{<>},sort%h  (not sure why this works, so maybe it doesn't:)

> /me scribbles notes.

Hey, you don't need any more weapons! :)

-- Mike

Michael W. Thelen
eval unpack u,'M*"1C/2<P,BDN-"`U+C`A(RLG*3U^>2\A+48O82UZ+SME=F%L*"1C+B(G=2HGM+"<Z,D<U4SU<(B%!.T9=5#HF-5(H)2%%/$907$`Z)B5#.E8U4BM@2&`G+EPD$+R(I.P``'

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