First use of MID/LEFT/RIGHT?

I’ve spent a fair amount of time tracking down oddball dialects of BASIC and one bit I’ve still never nailed down for sure:

What was the first BASIC dialect to use the MID/LEFT/RIGHT syntax for string manipulation?

Dartmouth didn’t get any form of string manipulation until Version The Fourth of (early) 1968 and this used the CHANGE command. Some variation on this theme was used in most mainframe dialects.

HP BASIC from the 2000 series appears to be the first to use slicing, although they blew it and used the identical syntax as array accessing and thus made it impossible to have a string array. Many later micro versions failed to address this problem (I’m looking at you Apple and Atari). This was addressed in Sinclair’s dialect (using “A TO B”) and in Full/ANSI BASIC (using “A:B”).

I’ve long thought MID/LEFT/RIGHT came from DEC when they finally ditched FOCAL on their larger systems. But from what I understand, their first dialect with this feature is from around 1970? Does anyone know for sure?

I also know that Tymshare’s SUPER BASIC included these, and I believed they were the first. These date to late 1968.

What has thrown all of this into confusion is when I came across the manual for TENET BASIC from July 1970 on the TENET 210 (which was built to the extent of a single example). This also uses MID/LEFT/RIGHT, and as literally everything about this machine is deliberately derivative of some other platform, this really implies that there is some dialect earlier than 1970 that used this.

Can anyone here point to a dialect of BASIC that used this syntax prior to ~1968?

1 Like

It may be also interesting, which BASIC dialect was influential enough to spread this. (The TENET 210 doesn’t look like it.)

The OS/8 team at DEC certainly hadn’t got the memo about LEFT/MID/RIGHT. BASIC for OS/8 has the unusual SEG$() function:

SEG$(X$,Y,Z)   Returns the sequence of characters in a string (X$) between two positions in the
               string (X,Y)

Example:       30 LET R$=SEG$(“ABCDEF”,2,4)

will assign R$ a value of BCD

OS/8 came later (1972?), though

I was hoping that one of the time-sharing systems (such as Service Bureau Corp’s (= IBM, in weak disguise) CALL/360:BASIC) might’ve introduced the syntax you’re looking for, but so far I’m drawing a blank too.

BASIC for the IBM 5100 (which is System 3 BASIC, I believe) has STR(X$,Y,Z), where Y is the start index and Z the length.

Seems to be identical to MID? Easy enough to add as an alias for any code that might use it.

I suspect this is only slightly (if at all) modified from the original that Ahl bought for the PDP-8.

Also seems identical to MID$? Sadly, practically every other version has a STR for num->string.

Regarding “is it MID$?”. I think this is more like substr() and substring():

SEG$("ABCDEFGH",2,4) => "BCD" (start-index to end-index)


STR("ABCDEFGH",2,4) => "BCDE" (4 characters beginning with start-index)

OS/8 BASIC source has internal DEC authors from its first publication in 1972. It doesn’t look like a bought-in product

which BASIC dialect was influential enough to spread this. (The TENET 210 doesn’t look like it

Indeed, and I would think the same is true for Tymshare. DEC, yes, but how would they even know of SUPER-BASIC, as opposed to, say, HP’s array slicing?

But even while writing this… there is every possibility that BASIC-PLUS was written by someone from Tymshare, or someone who wrote it for Tymshare.

I think I need to figure out who the original authors of BASIC-PLUS might have been.

Microsoft BASIC, for the Commodore PET and no doubt other systems, had LEFT$, RIGHT$ and MID$, back in the late 1970s.

MID$ could be used without the optional third parameter, to slice from a given starting point to the end of the string.