Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!unmvax!nmtsun!caasnsr From: caasnsr@nmtsun.nmt.edu (Clifford Adams) Newsgroups: comp.lang.forth Subject: Re: Re: Real programmers Keywords: forth, lisp Message-ID: <3002@nmtsun.nmt.edu> Date: 24 Jul 89 06:08:43 GMT References: <8907171553.AA17414@lilac.berkeley.edu> <7135@medusa.cs.purdue.edu> <30044@cornell.UUCP> Reply-To: caasnsr@nmtsun.nmt.edu (Clifford Adams) Organization: New Mexico Tech, Socorro NM Lines: 58 In article <30044@cornell.UUCP> travis@svax.cs.cornell.edu (Gregory Michael Travis) writes: >Big Deal? Do you know how elegantly it can be done? Does that matter? Sure >it does. abstract languages like lisp, and forth (sort of) are amazingly >expressive, and it is no useless fact that they can implement one another. > > Gregory Michael Travis I once wrote LISP in FORTH on my Commodore 64 with ~50k free for FORTH words. The source was about 40-50 screens, and implemented about 50 LISP functions. I later rewrote it for the Suns, and it takes about 60K of source code (including many comments). It ran fairly fast, at the same order of magnatude as the native lisp (written in C). It also compiled in less than 1 minute on a loaded SUN-3. Later on in the project I changed directions on it and started to develop a hybrid language--forth with lisp features. I finally had to stop research because I couldn't afford the disk space to store it. (my full development environment approached 400k). What I really liked about the Forth approach was that it was really easy to change the modular parts of the code (like the address space). I also liked how the top level of the code was simple and fairly obvious in control flow (unlike lisps written in C). I also liked the simplicity of adding functions to the core system. Here is a sample (from old memory): \ adds the two arguments in the list that is passed. Returns a number atom. : lisp-add ( args -- sum) lis>2args \ checks for, and converts the list into two items atom># swap atom># \ converts the two atoms to FORTH numbers + \ actually adds them #>atom ; \ changes the number back to a LISP atom \ inserts the LISP function "add", which calls the FORTH function "lisp-add" subr add lisp-add Here is an example of how I could use the above word: ok read ( print ( add 3 7 ) ) eval \ reads the list, then eval's it 10 ...assuming that one has defined the "print" function. Well, this has rambled on long enough. These postings do bring back memories, however. -- Cliff P.S. I once implemented the main core of LISP in LOGO. It took less than one page to implement 6 LISP functions, plus eval. -- Clifford A. Adams --- "I understand only inasmuch as I become." caasnsr@nmt.edu ...cmcl2!lanl!unm-la!unmvax!nmtsun!caasnsr (505) 835-6104 | US Mail: Box 2439 Campus Station / Socorro, NM 87801