Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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

by Masem (Monsignor)
on May 21, 2001 at 22:39 UTC ( #82045=note: print w/replies, xml ) Need Help??


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

Ok, it's probably going to depend on how you decide to pop off the stack. Given "N1 N2 o" in RPN where N1 and N2 are the numbers and o the operation, the LTR should be "N1 o N2".

Yes, '/' would need to be 4. And yes, the second one poses the problem if there's no indication of order being important on an operation ("a op b" not being equal to "b op a"). Chipmunk's got part of the problem with associtivity in his 171 char solution, but I might need to restate the problem to handle this concept; at the time, I was only aiming for a general solution assuming that order didn't matter.


Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
  • Comment on Re: Re: Re: Re: Re: (Golf) Reversing RPN Notation

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Re: (Golf) Reversing RPN Notation
by MeowChow (Vicar) on May 22, 2001 at 00:02 UTC
    Almost. The rule that "a op b" != "b op a" is not the same rule as "a op (b op c)" != "(a op b) op c". The former is commutativity, while the latter is associativity.
       MeowChow                                   
                   s aamecha.s a..a\u$&owag.print

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://82045]
help
Chatterbox?
[Corion]: marto: Oh, I'm jealous. I'm going to see DM in Frankfurt, but it's a stadium full of people, so, rather a big thing where you mostly get to see the band on screens ;)
[marto]: yes, the last time I saw them was in Berlin a few years ago, at the old Olympic stadium
[marto]: After Sunday I don't think I'll go see them again :)
[LanX]: Corion: come on, people are people! ;)
[Corion]: Naah, I think it's still an OK show so far. Their new songs aren't exactly great, but I'm not going there for new material anyway ;)
[marto]: I got the feeling from the last show that for big sections of it, they were not really into what they were doing

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (14)
As of 2017-03-24 11:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (301 votes). Check out past polls.