Computer One FORTH

Anything QL Software or Programming Related.
User avatar
polka
Trump Card
Posts: 196
Joined: Mon Mar 07, 2011 11:43 am

Re: Computer One FORTH

Post by polka »

Last problem with roman numbers : they (to my knowledge) had no symbols for numbers larger than 1OOO ? so when you ask for roman notation of 32767 for instance, you get :

MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMDCCLXVII

I decided thus to add Y for 5000 and Z for 10000 (and also MY for 4000 and MZ for 9000 of course) to the list of basic romans, so that 32767 would be displayed like this :

ZZZMMDCCLXVII

To do this, one just has to add just after word M :

4000 ROMAN MY
5000 ROMAN Y
9000 ROMAN MZ
10000 ROMAN Z

I did it, but (in a hurry) made the mistake not to modify anything else, and got exactly the same answers as before, because words ROMAN and .ROMAN still began the bucket brigade with M

This gave me this other idea : why not use the DEFER...IS construct to switch between PLAIN roman notation and LARGE roman notation ? To do this one only has to creste a DEFERed word, let it be W

DEFER W

and two words to set its execution :

: PLAIN ['] M IS W ;
: LARGE ['] Z IS W ;

and have the (second) definition of ROMAN and the definition of .ROMAN call W instead of M

then asking :
PLAIN 32767 .ROMAN

you get
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMDCCLXVII

but asking :
LARGE 32767 .ROMAN

you get
ZZZMMDCCLXVII

Just for fun, if you ask :
12 .ROMAN

you get indeed
XII

in both case, but if you first type :
' I IS W

you will get instead
IIIIIIIIIIII

because you have set the bucket brigade to begin with word I

BYE Paul


May the FORTH be with you !
POLKa
RWAP
RWAP Master
Posts: 2834
Joined: Sun Nov 28, 2010 4:51 pm
Location: Stone, United Kingdom
Contact:

Re: Computer One FORTH

Post by RWAP »

I have enjoyed this discussion, although I struggle to follow the Forth - it has been a while....

The other number that Romans could not use was ZERO - wonder how they sent an order for supplies back to Rome, was it intentional that they ALWAYS had to order 1 of everything as a minimum? :)


User avatar
polka
Trump Card
Posts: 196
Joined: Mon Mar 07, 2011 11:43 am

Re: Computer One FORTH

Post by polka »

I have enjoyed this discussion,

Almost a monologue ?
although I struggle to follow the Forth - it has been a while....
Isn't it like bicycle ? Once you ride, you never forget it
The other number that Romans could not use was ZERO
Zero is only useful in positional numeration (for 10 20 100 etc.) the roman system being additive does not need it
- wonder how they sent an order for supplies back to Rome, was it intentional that they ALWAYS had to order 1 of everything as a minimum?
What is YOUR minimum when you order something ?

Fun/pun aside, if you own an original QL with only Sinclair microdrives and the 128K internal RAM, apart SuperBasic, FORTH is the only suitable development tool, that will not strain too much the fragile microdrives : you load the development environment once, the text editor once, and you access very sparingly your source files. And everything is contained in a memory segment of only 64K, so beside the memory dedicated to the display (32K), you even spare 32K for other little jobs or superBasic programs.

Wereas using C or other development tools, even assemblers, you cannot avoid making your microdrives whirr like crazy each time you compile or load any little bit of code. This is why I bought Sandy SuperQBoard and a double 3.5" discdrive so fast after my acquisition of Lattice C.

Anyway, FORTH is an interesting language to learn, not only because of its small footprint and interactivity - well adapted to the machines of the 80ties - but also because when you underestand it well (you ride it), you must see it like a (the first released) virtual machine - with user expandable machine code AND architecture ! This was not even claimed by Chuck Moore (the inventor ot FORTH), but nowadays, as we have the Java virtual machines, the .net technology, etc. to compare, the fact is really obvious.

Paul


May the FORTH be with you !
POLKa
Post Reply