Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!usc!ucsd!sdcc6!ir230 From: ir230@sdcc6.ucsd.edu (john wavrik) Newsgroups: comp.lang.forth Subject: Thoughts on Forth Message-ID: <6224@sdcc6.ucsd.edu> Date: 19 Jan 90 07:41:34 GMT Organization: University of California, San Diego Lines: 89 Some recent comments were made about the speed of the language Scheme. The claims made for its speed are not substantiated by my experience with the language. At the moment I am in the process of writing an article to explain some of the educational advantages of Forth. I use it in a course designed to introduce mathematicians to "computer algebra". My claim is that students can understand the issues involved in this area more quickly if Forth is the programming language -- and that Forth has the same advantages (in terms of isolation of implementation details, modularity, etc.) as other languages. To illustrate my point, I have examples of the same project implemented in three systems. The project is to implement a polynomial arithmetic package (polynomials of one variable with integer coefficients). Beginning Forth students implement this project in my course. The project also appears in the MuMath programming lessons written by David Stoutemyer and in the book "Structure and Interpretation of Computer Programs" by Abelson, Sussman and Sussman which is an introduction to Scheme -- thus we are comparing implementations written by experts. Here are the benchmarks. Polynomial Multiplication (1000 repetitions) TI Scheme 59.98 sec IBM-AT compatible MuMath 9.70 IBM-AT compatible F83 3.74 IBM-AT compatible Execution speed should not be taken as the sole measure of the merit of a language (see below). If it is, there is no doubt who wins. But, actually, execution speed is not the reason for the choice of Forth in this course. The fact of the matter is that the Forth version of this package is considerably easier for students to write and understand. Forth was introduced into this course to help prepare students for using MuMath (a LISP based system). -------- How does one measure the merit of a programming language? I. For some the measure is execution speed. For the record, here are some results for the Sieve of Eratosthenes benchmark (essentially the same code was used in each case): Sieve - 25 repetitions Interp BASIC 1472.50 sec IBM-AT compatible TILE 377.90 SUN 2 F83 high level 51.96 IBM-AT compatible F-PC high level 36.63 IBM-AT compatible Turbo BASIC 8.40 IBM-AT compatible Turbo Pascal 7.53 IBM-AT compatible Turbo C 4.72 IBM-AT compatible F83 low level 3.40 IBM-AT compatible (F83 low level means that some parts of the program were recoded in assembly language. No effort was made to optimize the code -- so the 3.40 figure is probably too high.) II. Others measure merit in terms of language attributes. Apparently there are people who say things like "my language is a referentially transparent applicative language, and your's isn't!". Or "I like my language because it has a more orthogonal approach to declarations and data types than yours" III. But maybe there is something else One of my students this year said, at the end of the Forth course, "I've had more fun programming in Forth this year than I've had in a long time" (spoken by someone who has programmed in 4 or 5 languages) ---------- Phil Koopman says we have to market Forth. Could we really get away with an ad campaign that says: "Remember how much fun programming used to be? It still is with Forth" John J Wavrik jjwavrik@ucsd.edu Dept of Math C-012 Univ of Calif - San Diego La Jolla, CA 92093