October 2024
Intermediate to advanced
272 pages
6h 54m
English
As an interface to the rest of the world, with all its diversity and uncertainty, an input/output subsystem is often one of the most challenging parts of a programming language. Historically, Forth has several different I/O layers, two explained in this section and one more in Forth Meets BASIC.
You’re already familiar with the word TYPE ( addr u -- ) that displays a string. You should use the word EMIT ( char -- ) to display just a single character. You could reimplement TYPE with EMIT, but please don’t, for the sake of performance.
| | : MYTYPE ( addr u -- ) 0 DO DUP I CHARS + @ EMIT LOOP ;↩ ok |
| | "Hello" MYTYPE↩ Hello ok 1 |
The following four words enable interactive ...
Read now
Unlock full access