I’m trying to finish the MAT commands in my multi-lingual BASIC. I have one bit to test, using MAT PRINT on a single-dim array.
I could swear I found an emulator for Version 4 and ran it on my machine. Now I cannot find any trace of such a beast. Nor can I find one online - all the emulators I have found are for V2 and lack the MAT commands.
Am I imagining this or is there a V4 emulator out there?
Commercializing on the rapid popularity of BASIC, Hewlett Packard (HP) in 1969 introduced the HP 2000A 16bit mini-computer for 16 concurrent users/students with Time-Shared BASIC (modeled after Dartmouth BASIC fourth edition 1968), targeting the midsize business segment and the educational market.
In response to HP 2000A Time-Shared BASIC success which tokenized BASIC statements, Digital Equipment Corporation (DEC) in 1970, introduced the DEC PDP-11 16bit mini-computer for 16 concurrent users/students with the RSTS-11 operating system and the DEC BASIC-PLUS interpreter designed by Nathan A Teichholtz. To distinguish its product from the competition, DEC BASIC-PLUS specifications added few enhancements to Dartmouth BASIC 5th edition 1969-1970. DEC also ported DEC BASIC-PLUS to its PDP-10 36bit mainframe product line, used by many universities that also offered remote access for high schools.
Again, a long shot, but there’s an example of MAT PRINT in the IBM 5110 Basic manual (pdf).
Lower case only?! let is not optional. dimensions of zero not allowed “mat print a” gives “no array specified”. This is not the one I was thinking of, but I’m not sure I trust it.
Well, it’s Windows, so I had no way of testing it.
Zero-based arrays were put in when one of the K’s (or the undergrads who wrote the BASIC system) noticed that users were having problems being consistent with starting with 0 or with 1. So you got a bonus entry with DIM A(n), n+1 entries with subscripts 0 to N, and everyone was happy but the purists
Dartmouth v4 did very different things if you ended a MAT PRINT statement with a comma or a semicolon. IBM BASIC was more steeped in its DP heritage, where its [MAT] PRINT USING … keywords were dangerously close to COBOL PICTURE clauses.
I can’t replicate v4’s behaviour in bas, Michael Haardt’s quite excellent Full BASIC interpreter. The latest version, 2.7, can be downloaded by copying the 2.5 download link and changing it to 2.7 :-/
Vectors may be used in place of matrices, as long as the above rules are observed. Since a vector like V(I) is treated as a column vector by BASIC, a row vector has to be introduced as a matrix that has only one row. namely row 1. Thus
DIM X(7), Y(0,5)
introduces a 7-component column vector and a 5-component row vector.
If V is a vector then
MAT PRINT V
will print the vector V as a column vector.
I’m trying to figure out exactly what a “column vector” is and how they are printed. Does this mean it prints each item on a separate line to produce a column, 7 lines long in this case? I have no idea, because it doesn’t provide any examples.
In fact, no one does. I looked in the IBM book that EdS linked to… no examples. Dartmouth’s own manual? No examples. Illustrating BASIC? No examples. School BASIC literally says “ask your teacher”.
db doesn’t handle vectors, and I’m not sure I would trust it even if it did, given all the other differences. None of the other emulators I’ve found support v4. Its like this feature wants to be lost to history!
When printing, if the last item in the print list is a vector and it is followed by a separator it will be printed as a column vector.
e.g.:
10 DIM A(4)
20 ΜΑΤ ΙΝΡUΤ Α
30 PRINT "THIS IS A ROW VECTOR"
40 MAT PRINT A,
50 PRINT "THIS IS A COLUMN VECTOR"
60 ΜΑΤ ΡRΙΝΤ Α
70 END
RUN
? 1, 2, 3, 4,
THIS IS A ROW VECTOR
1 2 3 4
THIS IS A COLUMN VECTOR
1
2
3
4
LINE 70 DONE
There’s an extensive section on MAT functions in Harry Katzan Jr’s “The IBM 5100 Portable Computer” manual. I’ll scan it and upload it as PDF, I guess.
OK, here it is… PDF, 565KB…
(I’ve just a simple printer-scanner, these days, so the quality isn’t that great. Sorry.)
PS: Mind that here, on the IBM 5100 (System 3 BASIC), array indices are 1-based.
(So, DIM X(7), Y(0,5) from the above vector example would result in X with 7 elements and the definition of Y would probably throw an error. Compare the introductory part on DIM in these pages.)