develooper Front page | perl.golf | Postings from July 2002

Re: more minigolf

Thread Previous | Thread Next
From:
Phil Carmody
Date:
July 12, 2002 01:24
Subject:
Re: more minigolf
Message ID:
20020712082418.45701.qmail@web21105.mail.yahoo.com

--- Ton Hospel <perl-golf@ton.iguana.be> wrote:
> In article
> <694BB7191495D51183A9005004C0B05452DE71@ir-exchange-srv.ir.com.au>,
> 	Andrew.Savige@ir.com writes:
> >> Does anyone else want to claim a golf trick?
> I claim:
>   $|-- and --$| as toggle.
>   ~- as a prefix -1 construct (e.g. in ~-pop)
> 
> I would be surprised if these weren't known
> before, but at least I discovered them independently.

The latter's very well known by anyone who's done low level bit
twiddling in x86, for example. 
The relation 
  -x = ~x+1
is implicit in the definition of a twos-complement architecture.
Rearrange and substitute for 
  ~-x = x-1

My solution to the latest mini-golf included it, I think I used it
because I wanted a _high precedence_ decrement, higher precedence
than a simple subtraction. Both of the unary operators dominate most
other operators' precendence. 
So I'd call it a high-precedence -1 trick rather than a prefix -1
trick.

Phil 

=====
-- 
"One cannot delete the Web browser from KDE without
losing the ability to manage files on the user's own
hard disk." - Prof. Stuart E Madnick, MIT. 
So called "expert" witness for Microsoft. 2002/05/02

__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com

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