Re: Speaking of Forth..

snipped-for-privacy@journey.com (Doug Hoffman) wrote in message wrote


Hi Even in our heads we actually do the calculation in an RPN fashion as you've demonstrated. The need for the infixed notation has more to do with formula manipulation than executing the problem. We have to go through precedence rules to do the action of calculations. Forth is a more natural control language. Remember, you are not expecting the robot to manipulate a formula, you are trying to tell it what to do and when to do it. Mixing things up with formulas don't help one have a good feel for time or order. The original post mentioned issues with strings and floating point. I suspect the main issue was the particular Forth that was used. There are all kinds of ways to deal with such things that can be more natural. In most Forths, floating point has been dealt with by things like using F+ to mean + of floating point numbers. This is mostly the result that Forth is not a typed language ( as it is generally used ). This isn't to say it can't be or that one can't formulate other ways to deal with such things. One can make the interpreter more context sensitive and hide complexities. This has little to do with the issues of RPN. For debugging complex actions, I will take RPN any time. Action flow follows program flow. There are no tricks that can mess you up. The program does everything you tell it to do and in sequencial order. It does nothing more and nothing less unlike other clever languages. Dwight
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
wrote

whoot!!!
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Hi You need to think a little more about how you actually work math in your head and not how you read math on paper. You take the two numbers 4 and 3 and then apply the operation plus to it. I don't know how one could do it any differently. I was taught to read 3 + 4 as well but that isn't to say that I actually think this while doing the calculation. Maybe there is a major difference in the way people think about this problem. That might explain why for some, RPM seems so natural while for others it is like sliding on coarse sand paper. I use the 3 + 4 as a tool to do things like simplify formulas. When I see a formula, such as 5 * ( 4 + 3 ), I break it into a sequence of: 1. take 4 and 3 together with an add. 2. take 5 and the result and multiply.
I don't execute this as: 1. take find the result of 5 times some quantity to be determined. 2. the quantity to be determined is the result of 4 plus 3 3. complete step 1.
This is how it is read but not how I calculate it.
Maybe you were taught different. No wonder so many people have difficulty abstracting into different kinds of math relations. There is too much confusion between the execution and the manipulation tools. Arithmatic and math are two different things. I never expected them to be the same in my mind. Dwight

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
But the point is, who cares how we first learned to add, but rather how do we want to add numbers in tyhe advanced stages. This would imply that Forth programmers want everybody to stay in the elementary grade technique of thinking. Thus the language died.

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Hi This is exactly opposite of the point that I was making. Advanced thinking in math is not arithmetic. Forth doesn't try to mix or confuse the two. Unlike most languages, Forth allows one to mix them if you want but making things more complex than they are is not good programming or good thinking. The language has never taken off for a few reasons that have little to do with RPN:
1. The language is simple enough at the base level that almost anyone can create a Forth once they have seen one. This means that there is little advantage for large commercial software houses to sell it. 2. The user can expanded Forth too easily. This means that value added software is difficult to sell unless it has a lot of investment in complexity. You won't see MS selling Forth or Forth applications. 3. Most CS schools teach that software should look for your errors and that somehow that will make more correct code. Actually, code that is more thoroughly check and exercised at lower levels tends to be more correct at higher level. This is a basic concept that is encouraged in Forth. 4. Most Forth programmers are self taught. This is a real problem for maintenance. When someone needs to maintain another's code. Coding styles are less restricted by the language. ( I'm a self taught Forth programmer. It has take me years to get rid of bad habits. ) 5. Chuck Moore stated that Forth is like a programmer amplifier. A good programmer can be quite a bit better. A bad one will be quite a bit worse.
Forth is about problem solving. It is based on simplifying program nesting so that problems can be more easily factored. Good factoring is not a disadvantage in programming. The language one uses should not make it difficult by excessive boiler plating. Forth allows one to transform the language into a problem specific language. This is why many hardware engineers find it such a good tool for hardware debug and development. Complexity in a programming language is good job security. You know that they will need to keep you around to fix the bugs that will constantly pop up. In the past, I've delivered several complex embedded application to customers and not had to fix a single bug. I may be wrong but I attribute that partly to the language that allowed me think and create solutions at the appropriate levels. It gave me pride to have a customer that had used one of my systems for 5 years tell me that he had never had troubles with the software. It surprised him when I told him that his system wasn't a mature product that it hadn't been used by many to work out all the bugs. His system was a "one of". Dwight

---snip---
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
wrote:

Looks like good fun.
That kit your using looks a bit like the older metal mecchano sets.
A compiled basic is basic that is converted by the compiler from basic to machine code on your pc so the microprocessor can run it directly. Usually runs a good bit faster than interpretted basic.
A lot of basic's are interepted, that is a program runs on the micro that interprets your basic code as it runs. Usually a lot slower.
Alex
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
In fact, your example is even worse than I first thought, because before you can even start producing an interpreter for FORTH, you've got to produce an interpreter for a 16-bit machine.
Sure, it's got 16 bit registers, but you can only access them in 8 bit chunks, and to copy one 16 bit register to another, takes a sequence of 4 instructions of the form...
Load Register A Low Byte Store Register B Low Byte Load Register A High Byte Store Register B High Byte
Altogether a very weird and almost unusable architecture, which is unfortunate because it had a full complement of _BOTH_ Branch _AND ALSO_ Skip instructions.

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
http://www.hpmuseum.org/journals/71forth.htm

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
I thought so. You know, I've had my HP-12c for almost 15 years now. The best calculator I've ever had. I still have the same batteries! The only times I need another calculator is when I have to find the sine of something. I love lending it out to my students and watching their reactions. If I'm lucky I can get into a disscussion about different ways of dealing with arithmetic. It's great!
--
chris in napa



Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
I miss my HP41,
It died a slow, languishing death.
Mike

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
The decision was made on hardware grounds - radiation hardened and low-power CMOS; and not on software grounds.
Having made their choice, they were then forced to write an interpreter of some sort to make the device usable.
Hardies, being rank amateurs as softies, go for Forth.

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.