[Tutor] A little math and Python: rpn - my last one

Scot W. Stevenson scot@possum.in-berlin.de
Thu, 22 Aug 2002 17:00:59 +0200


Hello Gregor, 

> my last version, this time a practical calculator:

/Herrlich!/. I wonder if it might be better to go back to one of your 
earlier versions, the one with the class, tho, because after playing 
around with my calculator for a while I remembered all kinds of other cute 
features I'd forgotten that might work better as methods: 

1. The stack has a limited size, and when an entry hits the top slot, the 
value will keep cascading down - uh, I'm not explaining this very well, am 
I - what I mean is that if you do

234
ENTER
ENTER 
ENTER

you can then just keep hitting '+' and it keeps adding 234 to the value.

2. There is a "Last X" register that lets you do clever things by recalling 
the value of the accumulator (or X register or what it is called) before 
the last operation. 

3. The "R arrow down key" will rotate thru the stack

4. The "x<>y" key will let you exchange the X and Y registers, in other 
words, the last item in the stack and the one above it. 

Yes, this is all icing, I know. But it was fun to have =8). 

Unfortunately, I'm going to be away from my computer for a few days, but 
I'll see if I can come up with some real code suggestions anyway...

Y, Scot

-- 
 Scot W. Stevenson wrote me on Thursday, 22. Aug 2002 in Zepernick, Germany  
       on his happy little Linux system that has been up for 1573 hours       
        and has a CPU that is falling asleep at a system load of 0.04.