Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Forth from the past

323 views
Skip to first unread message

Julian Fondren

unread,
Aug 23, 2016, 8:43:22 AM8/23/16
to
The following code (two blocks setting it up, one block with
example data) is from "FORTH APPLICATIONS" by S.D. Roberts,
published in 1989.

( A1 ASSOCIATION DRS)
: TERM <BUILDS 21 ALLOT DOES>
DUP 1 + SWAP C@ DUP 32 = IF
." NOT YET DEFINED" DROP
ELSE 0 DO DUP I 2 * + @ DROP
LOOP THEN DROP ;

: ['] [COMPILE] ' ;
: [''] ['] ['] ;

: NUMBER DUP 2 + C@ DUP 32 = IF
DROP 0 THEN ;

: INCREMENT 1 + 2DUP SWAP 2 + C! ;
-->


( A1 ASSOCIATION DRS)

: WRITE 2 * 1 + + SWAP NFA
SWAP ! ;

: -> [''] NUMBER DUP 10 = IF
." FIELD FULL " DROP 2DROP
ELSE INCREMENT WRITE THEN ;

;S


( EXAMPLE ASSOCIATION )
TERM EVENING TERM DISCO TERM CINEMA TERM THEATER
TERM RESTAURANT TERM GO_OUT TERM AT_HOME TERM TV
TERM READING TERM MUSIC TERM KNITTING TERM SLEEPING
TERM DANCING TERM DINNER TERM DRINKING TERM WESTERN
TERM THRILLER TERM PERFORMANCE
-> GO_OUT EVENING -> AT_HOME EVENING -> DISCO GO_OUT
-> CINEMA GO_OUT -> THEATER GO_OUT -> DINNER GO_OUT
-> TV AT_HOME -> READING AT_HOME -> KNITTING AT_HOME
-> SLEEPING AT_HOME -> WESTERN CINEMA -> WESTERN TV
-> THRILLER CINEMA -> THRILLER TV


Usage (with lowercased input):

evening GO_OUT AT_HOME OK
at_home TV READING KNITTING SLEEPING OK
tv WESTERN THRILLER OK
western NOT YET DEFINED OK


The @ DROP in TERM's loop I find particularly mysterious.
That really is how it is in the book, but it looks like an
transcription error. I assume that's where output should
happen.


A modern implementation with a gratuitous struct, and
reversed output (evening AT_HOME GO_OUT ok):

0
cell +field xt
cell +field next-term
constant term-node

: .terms ( term -- )
begin dup xt @ dup while
>name name>string type space
next-term @
repeat 2drop ;

: term ( "name" -- )
create 0 , 0 , does>
dup xt @ 0= abort" not yet defined"
.terms ;

: link ( term1 term2 -- ) \ XTs; make t2 possibly lead to t1
>body here over 2@ here term-node allot 2!
over next-term !
xt ! ;

: -> ( "term1" "term2" --)
' ' link ;

And another, more like the original code:

0
1 +field #terms
20 cells +field terms
constant term-data

: term ( "name" -- )
create 0 here term-data allot c! does>
count dup 0= abort" NOT YET DEFINED"
cells bounds do
i @ >name name>string type space
cell +loop ;

: link ( term1 term2 -- ) \ XTs; make t2 possibly lead to t1
>body tuck count cells + !
dup c@ 1+ swap c! ;

: -> ( "term1" "term2" --)
' ' link ;


-- Julian

Mark Wills

unread,
Aug 23, 2016, 11:05:15 AM8/23/16
to
I always found the code in that book to be impenetrable gibberish :-(

Julian Fondren

unread,
Aug 23, 2016, 12:45:11 PM8/23/16
to
On Tuesday, August 23, 2016 at 10:05:15 AM UTC-5, Mark Wills wrote:
>
> I always found the code in that book to be impenetrable gibberish :-(

Reading it, I wondered if Forth's problems didn't have their roots in
the early books written about it. But the Prolog-type code was OK.

Elizabeth D. Rather

unread,
Aug 23, 2016, 3:07:53 PM8/23/16
to
A lot of the trouble came from magazine articles, such as the famous
Byte Magazine article and numerous others from the late 70's and early
80's. Some of them were contributed by FORTH, Inc. Code examples were
considered "illustrations" not text, and were edited by the art dept.
with no possibility of review from the authors or contributors. Since
the code examples were full of "punctuation" (colons, semicolons,
commas, periods, etc.) the art dept. editors carefully closed up all the
extraneous spaces before the punctuation, thus rendering the code
utterly incomprehensible --> impenetrable gibberish.

Cheers,
Elizabeth

--
==================================================
Elizabeth D. Rather (US & Canada) 800-55-FORTH
FORTH Inc. +1 310.999.6784
5959 West Century Blvd. Suite 700
Los Angeles, CA 90045
http://www.forth.com

"Forth-based products and Services for real-time
applications since 1973."
==================================================

JUERGEN

unread,
Aug 28, 2016, 2:58:13 PM8/28/16
to
I am surprised about your comment. This can happen once - the next time you send a picture rather that they cannot edit - but Forth and the press is a very loose relationship anyway - even now 30 years later ...

foxaudio...@gmail.com

unread,
Aug 28, 2016, 9:26:22 PM8/28/16
to
It's hard for people today to imagine what Elizabeth is referring to.
I was working in an advertising company as a tech from from 1977 to 1979.
My then girlfriend, now spouse, was on the drawing board. She did "layout"
That meant taking pieces of photographic paper that had some words on it and
cutting them with an exact-o-knife and pasting the "copy" to the layout board
with hot wax as the adhesive.

ALL text was handled this way. A photo with small text would have been
consider much too low resolution for text by the print masters.

In 1979 we got a new "computerized" type-setting machine that could take
3 lines, or so, of text into ram and then print them to photo paper using a
spinning disk that had 2 or 3 fonts on it. The disk would allow light to pass
through the letter that was printing by timing the flashing of a Xeon lamp.
The light went through a lense assembly to create a high res image of the letter
on the photo paper. When you were finished the type-setting, the paper rolled
through a small photographic processor to develop the image, stop the developing
and "fix" the image.

The you started on the next few lines... and it was still not laid out.
You have to cut the sentences and place them in the space correctly for the
publication.

I could not make this stuff up. :-)

BF

JUERGEN

unread,
Sep 3, 2016, 9:59:22 AM9/3/16
to
I remember to sign off print material, and the layouts were adapted there and then physically moving the different parts around and stick them on again as required - the good old cut and paste process.
Proofing a new article is not much different from a debugging elsewhere and actually has not changed over the last century - just the tools are different.

Walter Banks

unread,
Sep 3, 2016, 7:57:35 PM9/3/16
to
On 2016-08-23 3:07 PM, Elizabeth D. Rather wrote:
> On 8/23/16 6:45 AM, Julian Fondren wrote:
>> On Tuesday, August 23, 2016 at 10:05:15 AM UTC-5, Mark Wills wrote:
>>>
>>> I always found the code in that book to be impenetrable gibberish :-(
>>
>> Reading it, I wondered if Forth's problems didn't have their roots in
>> the early books written about it. But the Prolog-type code was OK.
>>
>
> A lot of the trouble came from magazine articles, such as the famous
> Byte Magazine article and numerous others from the late 70's and early
> 80's. Some of them were contributed by FORTH, Inc. Code examples were
> considered "illustrations" not text, and were edited by the art dept.
> with no possibility of review from the authors or contributors. Since
> the code examples were full of "punctuation" (colons, semicolons,
> commas, periods, etc.) the art dept. editors carefully closed up all the
> extraneous spaces before the punctuation, thus rendering the code
> utterly incomprehensible --> impenetrable gibberish.
>

I was on the other end of this around that time.

Forth specifically had the ear of Byte through Carl Helmers at that time
the Byte editor. The role of white space in forth as opposed to other
languages was something that wasn't well known inside of Byte and
failure to anything available to the contrary the art department could
only rely on the style guilds. The article proofs were not flagged by
the authors as being in error.

It was a point in time that personal computing and computing in general
was rapidly growing.

The problem then as now is as a language forth is not well understood by
the general computing public. This is compounded even more by the forth
infighting over standards and practices. The multiple attempts to
standardize the language followed by the inevitable screaming of this
isn't really forth acrimonious posts to this newsgroup have seriously
stalled forth from becoming anything like a mainstream language.

I don't agree that it was the fault of the personal computing
publications at that time. Byte, Creative Computing and Kilobaud would
all have published a lot more material on forth if more authors with
real forth experience had simply authored them.

w..

JUERGEN

unread,
Sep 4, 2016, 2:23:24 AM9/4/16
to
Fully agreed. The editors do their best to publish something interesting. It seems they do not get material delivered. They are the interface to the wide public. Just google - forth language press release - and see what comes up. This would be information delivery to the editorial world, or at least what is visible. Or try Forth Language Articles

rickman

unread,
Sep 4, 2016, 2:05:21 PM9/4/16
to
But you should keep in mind how much of an improvement this was over
melting lead to pour into molds... 8^o

People have an incredible thirst for the printed word.

--

Rick C
0 new messages