
With the major focus on math that we have on this list, I think I should mention about by RPN (Reverse Polish Notation) project again. While as a whole the project is a bit large for students to take part in, they could focus on learning how stacks work and how RPN expressions are different from algebraic ones. Because few students have used RPN, they see it as a different system for algorithems than the algebraic stuff their used to, so, in a way, it is like a proto programming language to them. I realize that many teachers may not be aware of how RPN works, but a quick search on Google <http://www.google.com/> turns up some good tutorials within the first five links that can help get one started. At the moment there is not documentation, which will hopefully be forthcomming, but the text-based python program (thus cross platform) does have some online help will get one started. Also, more advanced students in need of a simple project may wish to contribute (dispite my earlier note) by helping me expand the range of supported operations (I have the five basic functions and exponents, plus stack operators). Anyway, this may be something a little bit more down to Earth for those of you weary (or not, if you prefere) of using 3D to teach programming. All this can be found at <http://www.rbisland.cx/brew.html#scripts>. I hope that this project is of interest to some of you and can aide you in teaching students (and maybe yourselves) to program better. -- - Gordon Worley http://www.rbisland.cx/ mailto:redbird@rbisland.cx

I use IDLE. I downloaded your modules. I can import them, but what to do next? Seems it'd take about 60 seconds to write a few lines showing a sample interaction in
format. Maybe post that here and do a link from your web page to the edu-sig archives. That'd be a big help. To expect such minimal documentation is not unreasonable, and really shouldn't take more than a few minutes of your time. Kirby

At 5:59 PM -0700 4/27/2000, Kirby Urner wrote:
Well, taking 60 seconds seems a bit much to load and perform a single operation (on my computer and the Windows boxen at school the program has run practically instantaniously). Instructions; hmm, let's see. Start by running rb_rpn.py (or just call it's main() function); this starts the current text based interface (I'm on a Mac and Tk support isn't that great, so I wanted a text-based interface first so that anyone can participate and I could do development (if someone would like to develop a Tk calculator interface, I'd be more than willing to accept the submition or help one in using my modules to create said calculator)). I think that the online help (reached by typing '?' when at the main propmt) is pretty clear as to how each mode works, but I'll provide some examples anyway. Before doing that, though, here are the available operators: + add x and y registers - subtract x from y * multiply x and y / divide y by x % modulo y by x ^ raise y to the x power doubling above opperators (++, %%, etc.) will cause operation to affect all registers -> roll registers x through t up <- roll registers x through t down a-> roll entire stack up a<- roll entire stack down <> flip x and y resiters pop pop stack popall empty the stack lastx get the last x value (does not work in interactive mode) The three modes work like this: interactive: i: [enter numbers here] i: [enter more numbers or do operations] ...keep doing this forever, if one'd like static: stack: [enter values to be put in stack, bottom to top, seperated by spaces] opperators: [enter operators, seperated by spaces] ...these cycle back and force, returning results on the second, until the mode is left expression: exp: [enter RPN expression as it would be written on paper (i.e. 4 5 + 3 -), seperating each number or operator with spaces] And that's it. I hope that gets those of you interested started. I'll be included this documentation with a new release of the scripts that I should be making tonight or sometime over the weekend, and that should hopefully get you started. Also, I'm not an IDLE user (doesn't run on the Mac) and thus don't know how it works, but you may find it easier to run these scripts from the interperter directly, if IDLE is anything like IDE on the Mac when asking for user input.
Well, if a few means ten, then I guess this documentation qualifies. In case anyone didn't see the first post, here is the address for where to download the scripts: <http://www.rbisland.cx/brew.html#scripts>. Oh, and just incase this produces problems, the files may be using carrage returns at the end of each line rather than what one's OS expects depending on how one's version of tar is configured. -- - Gordon Worley http://www.rbisland.cx/ mailto:redbird@rbisland.cx

The transition from polemicist to community activist may not be an appropriate one to try to make. But I'd like to try. And volunteer to be a (value-free) recording secretary for EDU-SIG, trying to assemble and package links of any kind that folks find relevant to the subject of Python and education. Shot-gun approach. Highly relevant to tangentially relevant - technical, polemic, docs or code. I do not intend to do any editing of anything. Just assembe and pass along to folks in the position of Guido and Stephen, let's say, to edit as they see fit for relevancy to the EDU-SIG page or O'Reilly. I am just looking to do some grunt work here. Make me do it. So am asking folks to post up cites with a line or two discription. I will also search the EDU-SIG archives. And I'll start - I consider Numeric and related documentation highly relevant: home: http://numpy.sourceforge.net/ on-line docs: http://numpy.sourceforge.net/numpy.pdf

Gordon -- Thanks for the boost. It was just that initial hurdle of knowing which module to import (I'd guess wrong), which made it seem difficult. To be very detailed: I created a subdirectory under Python called \rpn into which I unzipped your py files. Then I went:
That last command automatically triggered main() -- main() being the last line in the module -- and got me your prompt. The following is the first several lines of my session (I also explored other modes of course): Red Bird's RPN 0.4.1 Type i for interactive mode, s for static mode, e for expression mode, ? for help, or q to quit or leave mode (when in one). :e expression mode exp:4 3 + [4.0] [3.0, 4.0] [3.0, 4.0] 4 3 + [7.0] exp:4 5 * 2 + [4.0] [5.0, 4.0] [5.0, 4.0] 4 5 * [20.0] [2.0, 20.0] [2.0, 20.0] 20 2 + [22.0] As you can see, the program runs just fine in IDLE, which is just like the standard interpreted environment except color coded (computer output text in blue, my entered expressions in black). In the Windows environment, it's a choice between IDLE and a DOS box. As I've posted to edu-sig before, I see no real advantages to using DOS box Python for any purpose (unless that's all you've got) as IDLE gives the exact same experience (of using Python interactively), just in a much friendlier environment. As for Tk, I think the obvious thing, which might be fun to do, would be to wrap a simple RPN calculator interface around your modules. I always prefered Hewlett-Packards RPN calculators to TI's parentheses-infested ones. You have an Enter key to push a value on the stack, which is 4 levels deep. Even had a roll key for rolling values around. E.g. 3 [enter] 4 + gets you 7 (in bottom stack position). After you hit [enter] the first time, 3 is in the "y" position on the stack (2nd level), with a copy in "x" i.e.: 3 [enter] 4 + Stack a: a: a: a: z: z: z: z: y: y: 3 y: 3 y: ? x: 3 x: 3 x: 4 x: 7 <-------- visible What I'm forgetting (hence the question mark) is if the 3 stays in the y: position, so that repeated pressing of the + key gets you 10, 13, 16... (don't have a Hewlett-Packard around to test). Anyway, the important point is that the bottom of the stack is likewise what's displayed on the calculator. With tkinter (the Python wrapper to Tk), you'd just make some buttons in a frame, and have a read-only display box. If I were doing this, I'd add a prominent Enter key and basically emulate HP's most excellent design. GUI RPN calculators are already out there -- this wouldn't be the first or necessarily the fanciest. But it'd be a good example of how to use Tk with Python. A fun project. Conway's Game of Life is another one I'm thinking about doing (probably won't have time for either -- wouldn't be surprised if the latter had already been done (which doesn't mean I wouldn't do it again, as the point is learning, not being the one and only to have ever done something)). Kirby PS: my Python version of the Sieve of Erasthosthenes (another classic thing to do in any computer language) is now linked from the Prime Pages. See: http://www.utm.edu/research/primes/programs/Eratosthenes/

At 8:49 AM -0700 4/29/2000, Kirby Urner wrote:
I'd very much like to do such an interface, but on the Mac that just isn't really all that fesiable right now. Rumor has it, though, that this could be changing in a week or two, so I may be posting back here soon with a nice Tk example for everyone to use. If not, I would really appreciate it if someone coded something up.
Just to clarify, the register you labeled as a is generally refered to as t in all the HP documentation that I've seen. As for what happens in the last step, x and y are operated on and the result put into x, and the other registers copy down (i.e. y =z, z=t, t=t). This is 4 Level RPN, and while nice, my program impliments something closer to RPL, which has a variable size stack of infinite length (in your examples, each of the 'empty' registers does contain a value, even if it is just zero). Anyway, submisions are welcome, especially if anyone wants to help me impliment numpy support. I'll probably get to it eventually, but it is not as immediately important as some other issues. -- - Gordon Worley http://www.rbisland.cx/ mailto:redbird@rbisland.cx

Just to clarify...
Yeah, that rings a bell. No HP calc docs in my possession. I got into the HP65 in high school with friend Michael Brodheim (his dad a road engineer in the Philippines) -- one of the first programmables. Later my parents got me an HP45 while traveling through Portland (quite expensive in those days). The HP and WFF'N PROOF, a logic game using dice, are my two main exposures to RPN. Thanks. Kirby
participants (3)
-
Arthur Siegel
-
Gordon Worley
-
Kirby Urner