Jump to content
IGNORED

A worse programmers questions


Sid1968

Recommended Posts

On 10/22/2019 at 6:16 AM, apersson850 said:

Can you have a pointer to a word, and run it like that? As you define words, they are packed in memory, one after another.

Yes as Lee mentioned the word EXECUTE and ANS Forth has the word DEFER which is like Forward in PASCAL

Quote

Can you redefine a word, when more other words have been defined after it? How does it fit, if the new definition is longer?

Forth's word space is defined as Hyper-static.  You can define a routine called X and use it in subsequent code and then define something else called X and the old X will not be affected.  This is because lookup of labels starts with the last label defined so the newest X is found first.  So the short answer is yes, but I suspect that's not what you were looking for.

 

Quote

 

An other approach is to write a general math statement parser, so you can key in your function as a text string. But already there, the main task of the plotter is no longer plotting on the screen, but parsing and evaluating that function.

 

 

A Forth approach to this could be to just use factoring to create the factors in RPN notation, use mnemonic names taking advantage of the fact that you can use any characters for names and re-combine the factors to produce the final function. (not everybody's cup of tea, but it's how it can be done)

So something like:

 \ F(X)=COS(3X) + 3X^2  in Forth

 INCLUDE DSK1.TOOLS
 INCLUDE DSK1.TRIG
 INCLUDE DSK1.DEFER

DECIMAL 

 : ^2    DUP * ;

 DEFER F(X)

 : COS(3X) ( n -- n') 3 * COS ;
 : 3X^2    ( n -- n') ^2  3 * ;

 : FUNCTION1 ( n -- n') DUP COS(3X)  SWAP 3X^2  +  ;
 
 ' FUNCTION1 IS F(X)

 : TEST  ( n -- ) 0 ?DO  I F(X)  .  LOOP ;

This could be made as high level as possible but if infix notation was required an infix to RPN front end could be created that would then translate infix to RPN.

( this code outputs integer values that need to be scaled)

 

Edited by TheBF
Math mistake: INFIX TO RPN :-(
Link to comment
Share on other sites

7 hours ago, TheBF said:

Yes as Lee mentioned the word EXECUTE and ANS Forth has the word DEFER which is like Forward in PASCAL

Forth's word space is defined as Hyper-static.  You can define a routine called X and use it in subsequent code and then define something else called X and the old X will not be affected.  This is because lookup of labels starts with the last label defined so the newest X is found first.  So the short answer is yes, but I suspect that's not what you were looking for.

Yes, I know you can re-use the same name, but that it doesn't really re-define the word in the contexts where it has already been used.

So you can't define FX, define a plotter that uses FX and finally make new definitions of FX. The new definitions will replace the old, for words written now, but will not re-define FX for the plotter package. It will still see the old FX.

Now I'm not sure exactly how DEFER works. Would this code do the same thing as the example you posted?

 \ F(X)=COS(3X) + 3X^2  in Forth

 INCLUDE DSK1.TOOLS
 INCLUDE DSK1.TRIG
 INCLUDE DSK1.DEFER

DECIMAL 

 : ^2    DUP * ;

 DEFER F(X)

 : COS(3X) ( n -- n') 3 * COS ;
 : 3X^2    ( n -- n') ^2  3 * ;

 : TEST  ( n -- ) 0 ?DO  I F(X)  .  LOOP ;

 : FUNCTION1 ( n -- n') DUP COS(3X)  SWAP 3X^2  +  ;
 
 ' FUNCTION1 IS F(X)

If you now use TEST, would you get the same result as in your example? Note that I've changed the order of things.

If it does give the same result, then you've accomplished what I was looking for. You can expect the user to re-define F(X) and again use the plotter. This is equivalent to asking the user to key in a BASIC program line defining the function, but perhaps easier to accept in Forth, since you go back and forth between defining and executing words all the time there. In BASIC, there more of a context switch, as you use RUN to start executing, and that's clearly distinguished from immediate mode. In Pascal even more so, as there is no "immediate mode", and you need to run the compiler between creating and executing a new program.

 : FUNCTION2 ( n -- n') DUP COS(3X)  SWAP 3X^2  -  ;
 
 ' FUNCTION2 IS F(X)

After this, then running TEST would evaluate this function instead. But I'm not sure that's what you get?

Link to comment
Share on other sites

26 minutes ago, apersson850 said:

Yes, I know you can re-use the same name, but that it doesn't really re-define the word in the contexts where it has already been used.

So you can't define FX, define a plotter that uses FX and finally make new definitions of FX. The new definitions will replace the old, for words written now, but will not re-define FX for the plotter package. It will still see the old FX.

Now I'm not sure exactly how DEFER works. Would this code do the same thing as the example you posted?


 \ F(X)=COS(3X) + 3X^2  in Forth

 INCLUDE DSK1.TOOLS
 INCLUDE DSK1.TRIG
 INCLUDE DSK1.DEFER

DECIMAL 

 : ^2    DUP * ;

 DEFER F(X)

 : COS(3X) ( n -- n') 3 * COS ;
 : 3X^2    ( n -- n') ^2  3 * ;

 : TEST  ( n -- ) 0 ?DO  I F(X)  .  LOOP ;

 : FUNCTION1 ( n -- n') DUP COS(3X)  SWAP 3X^2  +  ;
 
 ' FUNCTION1 IS F(X)

If you now use TEST, would you get the same result as in your example? Note that I've changed the order of things.

If it does give the same result, then you've accomplished what I was looking for. You can expect the user to re-define F(X) and again use the plotter. This is equivalent to asking the user to key in a BASIC program line defining the function, but perhaps easier to accept in Forth, since you go back and forth between defining and executing words all the time there. In BASIC, there more of a context switch, as you use RUN to start executing, and that's clearly distinguished from immediate mode. In Pascal even more so, as there is no "immediate mode", and you need to run the compiler between creating and executing a new program.


 : FUNCTION2 ( n -- n') DUP COS(3X)  SWAP 3X^2  -  ;
 
 ' FUNCTION2 IS F(X)

After this, then running TEST would evaluate this function instead. But I'm not sure that's what you get?

Exactly right  TEST can be compiled first, but F(X) will have different results depending on what its "execution token"  "IS". 

 

The meaning is as follows:

  1.  '   looks up the following word in the dictionary and returns the "execution token" (typically an address) on the data stack
  2.  IS  assigns the execution token on the stack to the following "DEFERed" word

I believe this is similar to C++ "virtual functions" but to me much simpler to understand. (Most of C++ is cryptic to me) :)

 

And yes Forth does let you move from interpreting immediately to compiling rather seamlessly.  

I believe that the new language Swift lets you do similar things thus removing the need for a pre-processor, but I may have mis-understood that. 

 

Some parts of Forth switch from immediate to compiling "in the background" which is a big controversy in the Forth community. :)

"Tempest in a teapot"  as we say in English. (IMHO)

 

Edit:  I should add that in CAMEL99 Forth if you run F(X) before giving it an execution token, it aborts to the interpreter with "Un-defined DEFER" 

That behaviour is not specified in ANS/ISO Forth and in bigger system would probably use THROW to set the error and CATCH would handle it later in a program defined way. (way to detailed maybe?)

 

Edited by TheBF
Additional info
Link to comment
Share on other sites

Of course the great thing about having an interpreter is that guessing what your code does is deprecated.

Given

DECIMAL

 : ^2    DUP * ;

 DEFER F(X)

 : TEST  ( n -- ) 0 ?DO  I F(X)  .  LOOP ;

 : COS(3X) ( n -- n') 3 * COS ;
 : 3X^2    ( n -- n') ^2  3 * ;

 : FUNCTION1 ( n -- n') DUP COS(3X)  SWAP 3X^2  +  ;
 : FUNCTION2 ( n -- n') DUP COS(3X)  SWAP 3X^2  -  ;
 : FUNCTION3 ( n -- n') COS(3X) ;
 : FUNCTION4 ( n -- n') 3X^2 ;

We can just try it. ( I love the paste feature in CLASSIC99)

 

 

DEFERFUNCTION.png

  • Like 1
Link to comment
Share on other sites

Thank you. I don't have any emulator installed on this computer.

At least this implies that assuming the user has some programming skill, in the actual language (Forth or BASIC, in this case), then the approaches to use this principle in Forth, and using the method of entering a code line in BASIC, are conceptually equal.

Thus a function plotter could use the plot environment that works best, and allow function input by programming it.

 

It's not as fool proof as having the user enter a function as a text, parse and generate code for it (evaulate it, that is), but a lot easier to do. Based on this concept study we can say that a solution is in place. Acutally implementing it isn't important, since nobody will use this program anyway.

Edited by apersson850
  • Like 1
Link to comment
Share on other sites

9 hours ago, TheBF said:

Yes as Lee mentioned the word EXECUTE and ANS Forth has the word DEFER which is like Forward in PASCAL

 

fbForth does not have the DEFER ... IS mechanism but defining those two words (and words supporting them) is not difficult. It is merely a programmer-friendly form of vectored execution. For vectored execution, you could store the execution token (cfa) of the word to be executed in a variable followed by executing the contents of said variable:

0 VARIABLE POINTER
: FX POINTER @ EXECUTE ;
: FX1 ... ;
: FX2 ... ;
: FX3 ... ;

 

FX1, FX2, FX3 can be defined at any time after the first two functions  and can be executed by FX in the following manner:

' FX1 CFA POINTER !    \ stores execution token of FX1 in POINTER
FX                     \ executes FX1
' FX2 CFA POINTER !    \ stores execution token of FX2 in POINTER
FX                     \ executes FX2
   etc.

 

This is easily simplified by defining FX to execute another word directly and subsequently changing that other word:

: FX NOP ;         \ initially, define FX doing nothing
' FX1 CFA ' FX !   \ stash execution token in parameter field of FX
FX                 \ execute FX1 via FX

 

I should probably take further discussion over to the main fbForth thread.  |:)

 

...lee

  • Like 1
Link to comment
Share on other sites

  • 1 month later...
On 9/29/2019 at 12:44 AM, Lee Stewart said:

 

Forth was invented in 1970 by Charles Moore to help control radio telescopes. As to the nature of Forth, there is this from the Forth Interest Group   website  :

 

What is Forth?

  • Forth is a stack-based, extensible language without type-checking. It is probably best known for its "reverse Polish" (postfix) arithmetic notation, familiar to users of Hewlett-Packard calculators. Forth is a real-time programming language originally developed to control telescopes. Forth has many unique features and applications:
  • Forth can compile itself into a new compiler!
  • Reverse-polish coding.
  • Edit time error checking and compiling (similar to BASIC).
  • Extremely efficient thread based language.
  • Can be used to debug itself!
  • Extensible, thus can become what ever you need it to be.
  • Many freeware implementations are available.
  • Many commercial applications: language translators, animation (movies, DisneyLand), hard disk controllers.

fbForth is a dialect of Forth. It is based on TI Forth, both of which were developed specifically for the TI-99/4A computer from figForth (see above Forth Interest Group website). If you are interested in the differences between fbForth 2.0 and TI Forth, see “Since TI Forth” on my fbForth website.

 

As to the answer to your first question, You can write pretty much any application you wish for the TI-99/4A. You can do anything with the TI-99/4A that you can do in any other computer language on the TI-99/4A, including Assembly Language.

 

...lee

Hi Lee, Can you compile the forth program and store it as a stand alone application that can run in its own cartridge or have the BIN file in a final grom 99 SD card? Is there already games that were made using forth ?

  • Like 1
Link to comment
Share on other sites

4 hours ago, Davvel said:

Hi Lee, Can you compile the forth program and store it as a stand alone application that can run in its own cartridge or have the BIN file in a final grom 99 SD card? Is there already games that were made using forth ?

 

I designed fbForth 2.0 as a cartridge program so, yes, it runs in its own cartridge (I have them or you can burn your own—see links in my signature). For the FinalGROM99, see this link.

 

As to games, there are a few around. There is a very nice one called DARKSTAR that I ported to fbForth 2.0 from @Willsy’s TurboForth version. It is in the latest version of the ZIP file you will download from one of the aforementioned links. All of those links are up to date except for my website, which it is a build behind—I have been a little busy pitching horseshoes on the beach down here in Florida. :P

 

...lee

Link to comment
Share on other sites

39 minutes ago, Ksarul said:

There is also the Jetpack game @Vorticon made (for TurboForth). That one also combines the game with the Forth language to make a single cartridge out of both programs that launches straight into the game.

Except that no one outside of Willsy knows how that was done! There are a couple of bugs that I corrected in the disk version but not in the cart version because Willsy no longer remembers how he got it done. Apparently it was a fairly involved process. He promised to work on it once life permits :)

  • Like 1
Link to comment
Share on other sites

9 minutes ago, Vorticon said:

Except that no one outside of Willsy knows how that was done! There are a couple of bugs that I corrected in the disk version but not in the cart version because Willsy no longer remembers how he got it done. Apparently it was a fairly involved process. He promised to work on it once life permits :)

 

He may not remember exactly how he did it, but I am sure he remembers what he had to do, which would have been to remove words not needed by JetPack to make room for JetPack’s words.

 

I was going to port JetPack to fbForth 2.0, but got sidetracked somehow. |:)

 

...lee

  • Like 1
Link to comment
Share on other sites

17 hours ago, Lee Stewart said:

 

I designed fbForth 2.0 as a cartridge program so, yes, it runs in its own cartridge (I have them or you can burn your own—see links in my signature). For the FinalGROM99, see this link.

 

As to games, there are a few around. There is a very nice one called DARKSTAR that I ported to fbForth 2.0 from @Willsy’s TurboForth version. It is in the latest version of the ZIP file you will download from one of the aforementioned links. All of those links are up to date except for my website, which it is a build behind—I have been a little busy pitching horseshoes on the beach down here in Florida. :P

 

...lee

Hi Lee

 

What I meant was that can the product of forth be placed in a cartridge and be executed without requiring your forth cart. Like when one writes an assembly program you just plugin that product in a TI and it comes up as menu number 2. The assembled and linked code does not need anything else to run. 

 

Thanks

 

David

Link to comment
Share on other sites

6 hours ago, Davvel said:

Hi Lee

 

What I meant was that can the product of forth be placed in a cartridge and be executed without requiring your forth cart. Like when one writes an assembly program you just plugin that product in a TI and it comes up as menu number 2. The assembled and linked code does not need anything else to run. 

 

Thanks

 

David

That should work, since fbForth is no Interpreter. Only Interpreterprograms do need the present of the Interpreter itself. E.g. a Basicprogram needs Basic running. So far as i know is fBForth a compiler. There are Basicversion that can compile like the version from Senior_Falcon. But the standard Basic is an Interpreter.

Edited by Sid1968
Link to comment
Share on other sites

17 hours ago, Davvel said:

Hi Lee

 

What I meant was that can the product of forth be placed in a cartridge and be executed without requiring your forth cart. Like when one writes an assembly program you just plugin that product in a TI and it comes up as menu number 2. The assembled and linked code does not need anything else to run. 

 

Thanks

 

David

 

The simple answer is, “No”.

 

Forth is a threaded interpretive language, consisting of a dictionary (singly-linked list of words—executable routines) and two interpreters. The outer, text interpreter ( INTERPRET ) is in control inside an infinite loop when you start Forth. The outer interpreter’s job is to

  1. Get the next space-delimited token in the input stream and look it up in the dictionary.
  2. If it finds the word, INTERPRET passes the word’s Code Field Address (cfa) off to the inner, address interpreter ( EXECUTE ) for execution.
  3. If it does not find the word, it attempts to convert it to a number in the current radix (number base).
    • If successful, it pushes the number to the parameter (data) stack. 
    • If not successful, it issues an error message (usually, a repeat of the text of the input token followed by ‘?’)
  4. Loop back to (1).

When you write an fbForth 2.0 program, you are defining new words that get added to the dictionary. When you run the program, you will be executing those new words, which depend on a subset of the 500+ existing words, most of which are in the cartridge.

 

To create an fbForth 2.0 program cartridge may not be impossible, but it would be a truly daunting task to keep it below 32 KiB. At the very least, the resident dictionary would need to be cleared of unused words to make room for the user’s Forth code.

 

Having said all that, if the FinalGROM99 can handle cartridge code bigger than 32 KiB, it actually would be pretty simple (I think!) to add the user’s Forth code to the extra space along with code that would copy it to the upper 24 KiB of expansion RAM and start the program. 

 

...lee

  • Like 2
Link to comment
Share on other sites

2 hours ago, Sid1968 said:

That should work, since fbForth is no Interpreter. Only Interpreterprograms do need the present of the Interpreter itself. E.g. a Basicprogram needs Basic running. So far as i know is fBForth a compiler. There are Basicversion that can compile like the version from Senior_Falcon. But the standard Basic is an Interpreter.

FbForth is both an interpreter AND a compiler (albeit not a native code compiler).

 

To use a conventional Forth to make a standalone program requires adding a "target compiler" on top of the Forth system.  This is tricky but very interesting to build.

You actually would build a small Forth kernel in separated memory, use that to make the program work but NOT compile the interpreter into the kernel. Then save that memory image as EA5 or TI-99 object code.

 

You would have to copy the Assembly language routines that you need from FbForth into the target memory and then reference them with the new Forth your are building. Kinda makes your head spin if you think about too much but you literally have two Forth systems in memory at the same time!

 

Here is an example of how it begins for the insanely curious:

\ EXAMPLE TARGET COMPILER FOR FBFORTH *un-tested* 
VOCABULARY TARGET

( *LOAD THE ASSEMBLY LANGUAGE "PRIMITIVES" )

TARGET DEFINITIONS
HEX 2000 CONSTANT TARGET-MEM

\ Target memory manager
VARIABLE DP   ( dictionary pointer)

TARGET-MEM  DP !                 ( set DP to start of target memory)
: HERE      ( -- addr) DP @  ;   ( HERE is like $ in Assembler)
: ALLOT     ( n --)   DP +! ;    ( move memory pointer by n 
: ,         ( n -- ) HERE !  2 ALLOT  ; ( ** COMMA OPERATOR ** )
: C,        ( c -- ) HERE C! 1 ALLOT  ; ( ** CHAR COMMA for bytes ** )
: ALIGN     ( -- )   HERE ALIGNED DP ! ;
: PAD       ( -- addr) HERE 100 + ;
: COMPILE   ( -- )  R> DUP 2+ >R @ , ;

etc...

 

 

 

 

  • Like 2
Link to comment
Share on other sites

3 hours ago, Lee Stewart said:

 

The simple answer is, “No”.

 

Forth is a threaded interpretive language, consisting of a dictionary (singly-linked list of words—executable routines) and two interpreters. The outer, text interpreter ( INTERPRET ) is in control inside an infinite loop when you start Forth. The outer interpreter’s job is to

  1. Get the next space-delimited token in the input stream and look it up in the dictionary.
  2. If it finds the word, INTERPRET passes the word’s Code Field Address (cfa) off to the inner, address interpreter ( EXECUTE ) for execution.
  3. If it does not find the word, it attempts to convert it to a number in the current radix (number base).
    • If successful, it pushes the number to the parameter (data) stack. 
    • If not successful, it issues an error message (usually, a repeat of the text of the input token followed by ‘?’)
  4. Loop back to (1).

When you write an fForth 2.0 program, you are defining new words that get added to the dictionary. When you run the program, you will be executing those new words, which depend on a subset of the 500+ existing words, most of which are in the cartridge.

 

To create an fForth 2.0 program cartridge may not be impossible, but it would be a truly daunting task to keep it brlow 32 KiB. At the very least, the resident dictionary would need to be cleared of unused words to make room for the user’s Forth code.

 

Having said all that, if the FinalGROM99 can handle cartridge code bigger than 32 KiB, it actually would be pretty simple (I think!) to add the user’s Forth code to the extra space along with code that would copy it to the upper 24 KiB of expansion RAM and start the program. 

 

...lee

Thanks for your answer. Forth looks very interesting and I am curious to understand why it is not more popular today as a modern language instead of Java,  C# or C++ on modern machines.

  • Like 1
Link to comment
Share on other sites

19 hours ago, Davvel said:

Thanks for your answer. Forth looks very interesting and I am curious to understand why it is not more popular today as a modern language instead of Java,  C# or C++ on modern machines.

Ok I will give this a try.

 

It is interesting that you care comparing Forth by its description to Java, C# and C++.  When it was created by Charles Moore in the late 60s early 70s, he considered it to be a "fourth" generation language, moving beyond the 3rd generation languages of the day.

 

It has some properties that did not come along until the advent of OOPS in the 90s so in some ways it is advanced but in other ways very primitive.

 

Why is it not more commonly used? 

  1. Forth is low level programming out of the box. More like Assembler. You have to make the meta-language that you need.  The reason for this was that Chuck Moore found that programming languages were typically too much or too little, never having what he needed exactly. So Forth was made to with the ability to add on functionality by removing almost everything but a bare minimum of functionality and extensibility. :)
     
  2. It's not algebraic.  This makes is a pain in the backside for many people especially if your program will depend on complex equations from a branch of science or math that must be incorporated into the code.  Translating that to Reverse polish notation can be a chore. (the late Dr. Julian Noble made a translator in Forth to solve that problem for his own work in simulating car crashes which needed a pile of equations already coded in Fortran. He just made Forth understand the infix notation)
     
  3. Its not conventional.  The three languages you mention can all trace their roots back to a language called Algol.  If you know one of those three you can learn the others without too much effort. They are variations on a theme. OOP is probably the biggest addition to the family and it is a brain shifter for most people. 

    Forth like LISP is paradigm shift. And to be honest very few people use Forth the way the inventor does.  Chuck is a total minimalist, to an extreme that most find uncomfortable or maybe even wrong.  Learning to use Forth well is more like learning a human language. There are hundreds of words to learn, each one doing something so trivial that you are left wondering why the h_ll would I ever need such a simple thing.  However that is the paradigm. Use these simple widgets to build what you need like Lego blocks. Then use those bigger structures to create your program.
     
  4. It was really weird in the beginning. Chuck didn't use files for his source code. He used raw disk blocks.  This was ok when machines had no operating system in fact it was amazing. Chuck had Forth running with disk and multi-tasking on the IBM 360 in 4 days waaaay before IBM got O/S 360 running. I have read he was doing things with the 360 that the designers didn't know it could do. :)
    However this made people crazy once computers got decent OS's with file systems. 

 

So why learn Forth?

 

Even if you never use it learning a bit of Forth will teach you that some things you thought were complicated, are not.  It let's you see beneath the surface in a way that only working in Assembler does IMHO.  But unlike Assembler you can test small code snippets from the console and confirm your suspicions very quickly.  This interactivity is, for me, the the only way I can use the darn thing. I am not smart enough to think through really complex stuff so I just ask the machine.

It gives me the answer immediately. 

 

That's my take. Your mileage may vary.

 

 

 

 

  • Like 3
Link to comment
Share on other sites

4 hours ago, TheBF said:

Ok I will give this a try.

 

It is interesting that you care comparing Forth by its description to Java, C# and C++.  When it was created by Charles Moore in the late 60s early 70s, he considered it to be a "fourth" generation language, moving beyond the 3rd generation languages of the day.

 

It has some properties that did not come along until the advent of OOPS in the 90s so in some ways it is advanced but in other ways very primitive.

 

Why is it not more commonly used? 

  1. Forth is low level programming out of the box. More like Assembler. You have to make the meta-language that you need.  The reason for this was that Chuck Moore found that programming languages were typically too much or too little, never having what he needed exactly. So Forth was made to with the ability to add on functionality by removing almost everything but a bare minimum of functionality and extensibility. :)
     
  2. It's not algebraic.  This makes is a pain in the backside for many people especially if your program will depend on complex equations from a branch of science or math that must be incorporated into the code.  Translating that to Reverse polish notation can be a chore. (the late Dr. Julian Noble made a translator in Forth to solve that problem for his own work in simulating car crashes which needed a pile of equations already coded in Fortran. He just made Forth understand the infix notation)
     
  3. Its not conventional.  The three languages you mention can all trace their roots back to a language called Algol.  If you know one of those three you can learn the others without too much effort. They are variations on a theme. OOP is probably the biggest addition to the family and it is a brain shifter for most people. 

    Forth like LISP is paradigm shift. And to be honest very few people use Forth the way the inventor does.  Chuck is a total minimalist, to an extreme that most find uncomfortable or maybe even wrong.  Learning to use Forth well is more like learning a human language. There are hundreds of words to learn, each one doing something so trivial that you are left wondering why the h_ll would I ever need such a simple thing.  However that is the paradigm. Use these simple widgets to build what you need like Lego blocks. Then use those bigger structures to create your program.
     
  4. It was really weird in the beginning. Chuck didn't use files for his source code. He used raw disk blocks.  This was ok when machines had no operating system in fact it was amazing. Chuck had Forth running with disk and multi-tasking on the IBM 360 in 4 days waaaay before IBM got O/S 360 running. I have read he was doing things with the 360 that the designers didn't know it could do. :)
    However this made people crazy once computers got decent OS's with file systems. 

 

So why learn Forth?

 

Even if you never use it learning a bit of Forth will teach you that some things you thought were complicated, are not.  It let's you see beneath the surface in a way that only working in Assembler does IMHO.  But unlike Assembler you can test small code snippets from the console and confirm your suspicions very quickly.  This interactivity is, for me, the the only way I can use the darn thing. I am not smart enough to think through really complex stuff so I just ask the machine.

It gives me the answer immediately. 

 

That's my take. Your mileage may vary.

 

 

 

 

Thanks for your explanation, it is clear enough for me to appreciate the main difference and why it may not be that popular today. 

  • Like 1
Link to comment
Share on other sites

55 minutes ago, Davvel said:

Thanks for your explanation, it is clear enough for me to appreciate the main difference and why it may not be that popular today. 

By the way it is still used :)

 

The Fedex guys carry a device that is controlled by Forth. (After two sets of C programmers messed up) :) 

The Galileo space probe was programmed in Forth and a number of NASA experiments are code in Forth. (or were?)  

There is a bomb defuser written in Forth and a million line application that is used by the construction industry to do estimation on large projects.

And some of my code is still being used to count live baby chickens at the rate of 90,000 per hour in the USA, Canada and the Netherlands.

That's a lot of McNuggets!

It is still great for writing hardware control programs which is what it was invented for.  

 

  • Like 1
Link to comment
Share on other sites

15 hours ago, TheBF said:

By the way it is still used :)

 

The Fedex guys carry a device that is controlled by Forth. (After two sets of C programmers messed up) :) 

The Galileo space probe was programmed in Forth and a number of NASA experiments are code in Forth. (or were?)  

There is a bomb defuser written in Forth and a million line application that is used by the construction industry to do estimation on large projects.

And some of my code is still being used to count live baby chickens at the rate of 90,000 per hour in the USA, Canada and the Netherlands.

That's a lot of McNuggets!

It is still great for writing hardware control programs which is what it was invented for.  

 

Adding:

https://www.mpeforth.com/wp/wp-content/uploads/2015/12/MPE_PR_From_Telescope_to_Comet_2014_11_13.pdf

  • Like 3
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...