Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Re: Re: (Golf) Reversing RPN Notation

by bobione (Pilgrim)
on May 21, 2001 at 20:46 UTC ( #82009=note: print w/replies, xml ) Need Help??

in reply to Re: Re: (Golf) Reversing RPN Notation
in thread (Golf) Reversing RPN Notation

Both output :   2 - 3 + 4   and   2 - (3 + 4)   are correct but the first one is better because "minimize the use of parentheses". It seems to be good.

Update: MeowChow points something right !! I was dreaming when I read his post, forget it :)

BobiOne KenoBi :)

  • Comment on Re: Re: Re: (Golf) Reversing RPN Notation

Replies are listed 'Best First'.
Re: Re: Re: Re: (Golf) Reversing RPN Notation
by MeowChow (Vicar) on May 21, 2001 at 20:55 UTC
    Uh, no, addition and subtraction are left-to-right associative, which means that:
    2 - 3 + 4 = -1 + 4 = 3 while 2 - (3 + 4) = 2 - 7 = -5
                   s aamecha.s a..a\u$&owag.print

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://82009]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2019-12-10 02:57 GMT
Find Nodes?
    Voting Booth?

    No recent polls found