Harold Hallikainen email (remove spam text)
I haven't used FORTH in a while, but am constantly using my HP
15C and HP35 calculators, both of which operate very in a FORTH manner.
FORTH and RPN calculators really DO make sense... You give the machine
the numbers, then tell it what to do with them. This is also called post
fix notation, as opposed to the in fix notation we're more familiar with.
Consider a typical calculator's keystrokes...
2 first argument
+ I can't add anything yet!
3 second argument
= ok, I remember, he wanted to add!
On an HP (or FORTH), this would be something like
2 first argument, put on stack
3 second argument, put on stack
+ Replace two arguments on stack with one result
of sum, display
Also, most calculators that use algebraic notation often use a
mix of RPN and algebraic when they have single argument functions:
2 function argument
sqrt do the square root of it
This mix of in-fix and post-fix on algebraic calculators can make
it fun figuring out which to use when (along with hitting the equals key
a half dozen times). With RPN, the calculation proceeds the way you
would do it by hand (from the inner most parentheses on out).
FORTH is an interesting language, though it tends to be write
only (no one else can read it). I've seen some neat algorithms that
convert algebraic expressions to FORTH, which can then be easily
evaluated by a stack oriented machine.
Finally, years and years ago I licensed a 6800 Basic interpreter
from Microsoft. It's interesting to see how it evaluates an expression.
It actually scans the line left to right, interpreting as it goes along.
When it sees some sort of two argument operator (like + ), it goes on and
evaluates the second argument, which may involve recursive function
calls. It's pretty neat. When it finds a function call, it calls the
function evaluator, which then looks at the argument and calls the
function evaluator again to evaluate the argument to the function. This
continues until there is actually some number that is returned, then all
the functions return.
So... so much for Forth, RPN, and algebra!
Hallikainen & Friends, Inc.
See the FCC Rules at http://hallikainen.com/FccRules and comments filed
in LPFM proceeding at http://hallikainen.com/lpfm
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
or call Juno at (800) 654-JUNO [654-5866]
See also: www.piclist.com/techref/index.htm?key=forth
You must be a member of the
piclist mailing list
(not only a www.piclist.com member) to post to the