[Coco] Cocopedia updated

Christopher Smith csmith at wolfram.com
Mon Jul 29 18:24:34 EDT 2013


Still used, in fact, with newer HP calculators and still popular enough among engineering types.  I have a reasonably (within the last five years) new HP40G+ which has an RPN mode, which I quite like.  Several computer languages -- especially stack-based languages -- use RPN style mathematical precedence.  LISP and derivatives (Scheme, for example), Forth, that kind of thing...

To illustrate using a simple example, in algebraic/infix notation, we may say:

12/2-(1+2)

Precedence rules and so on tell us that we solve each side of the subtraction first, and then subtract.  The answer is 3.

Using RPN, we need to interpret the precedence ourselves, and the operations are built on a stack, so we would say:

12, 2 /

<the stack now contains 6>

1, 2 +

<The + operator reads 1 and 2 off of the stack and replaces them with the sum, 3.  The stack contains 6, 3>

-

... and this provides our answer.


It's _much_ more efficient for small computers than trying to make them interpret standard precedence rules... especially if they're stack-based anyway.

Chris

----- Original Message -----
> From: "Gene Heskett" <gheskett at wdtv.com>
> To: coco at maltedmedia.com
> Sent: Sunday, July 28, 2013 10:18:27 PM
> Subject: Re: [Coco] Cocopedia updated
> 
> On Sunday 28 July 2013 23:06:40 Richard E. Crislip did opine:
> 
> > On 07/26/2013 09:48 PM, Wayne Campbell wrote:
> > <Snip>
> > 
> > >>> http://www.cocopedia.com/wiki/index.php/The_Structure_of_I-Code
> > >>> 
> > >>> I will remember to include the link next time.
> > >>> 
> > >>> Wayne
> > >> 
> > >> Interesting Wayne.  I was never aware that basic09 was an rpn
> > >> language at heart.  But I can see where it has a speed advantage
> > >> at
> > >> execution time too. And I can recall using that sort of
> > >> sequencing
> > >> without knowingly hanging a 3 letter acronym on it at the time
> > >> in
> > >> some of my asm code over the years.
> > 
> > <Snip>
> > 
> > I am sure we are not talking about Revolutions Per Minute nor are
> > we
> > talking about Red Package Module. At least the context does not
> > lead me
> > to conclude that, soooo what does RPM stand for in this discussion.
> > TIA.
> 
> Re read what I wrote Richard.  I wrote RPN, for Reverse Polish
> Notation.
> First popularly used in HP's calculators in the 60's as it simplified
> the
> calculators design and reduced its memory usage considerably over
> that of a
> calculator that has to keep track of stuff by the normal algebraic
> rules,
> making sure it follows the normal operator precedence.  Simplified to
> the
> bone, you place the values of two items on the stack, then issue the
> +=, -
> =, /=, or *= command to get the answer.
> 
> Cheers, Gene
> --
> "There are four boxes to be used in defense of liberty:
>  soap, ballot, jury, and ammo. Please use in that order."
> -Ed Howdershelt (Author)
> My web page: <http://coyoteden.dyndns-free.com:85/gene> is up!
> My views
> <http://www.armchairpatriot.com/What%20Has%20America%20Become.shtml>
> Hempstone's Question:
> 	If you have to travel on the Titanic, why not go first class?
> A pen in the hand of this president is far more
> dangerous than 200 million guns in the hands of
>          law-abiding citizens.
> 
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
> 

-- 
Christopher Smith
Systems Engineer, Wolfram Research



More information about the Coco mailing list