[Elecraft] FORTH

Jessie Oberreuter joberreu at moselle.com
Sun Apr 17 23:54:21 EDT 2005


On Sun, 17 Apr 2005, Kevin Rock wrote:

> You are correct Vic.  I should have defined Love?  But then if you look in 
> the OED love takes a whole bunch of pages!
>
> A loop of 10,000 honks may be a bit excessive however ;)
>   Kevin.

      That was a delay loop!  Honk only emits one beep :).  You gotta love 
a language in which a statement like:

 	>> The definition of ? is
 	>> : ? @ . ;

makes complete sense :).  Actually, all of you RPN fanatics would love 
FORTH, as it is essentially RPN based.  Add some labels and control 
structures, and whalla!  You have a programming language!

 	2 3 6 * + .

Does just what you expect: 2, 3, and 6 get pushed on the stack, * 
multiples 3 and 6 and replaces them with 18, and + adds 2 and 18 and 
replaces them with 20.  The period (.) writes the result to the terminal 
and removes it from the stack.  If you do something often, you can add a 
new operation to the system with a colon definition:

 	: CUBE DUP DUP * * ;

and now you can write:

 	3 CUBE .

and it will pring 27!  Every modern RPN calculator should come with a 
built in FORTH :).






More information about the Elecraft mailing list