Slicing, not as modern as you thought

Patrick Schluter Patrick.Schluter at
Sun Jul 7 14:12:05 UTC 2019

After watching this retro-computing video [1] I was quite 
surprised to discover that the lowly Sinclair ZX81 already 
implemented slicing in its Basic string handling. The syntax was 
of course typical Basic ad hoc, but it seem to work quite nicely.

X$(1) would get the first character of string X$
X$(2 TO 4) would give the substr from offset 2 to 4
the interesting part is that it works also as lvalue so you could 
overwrite part of strings that way
X$(2 TO 4) = "ab"
Nice. I would have loved that at that time but neither 
TI-(Extended)-Basic nor Microsoft derived Basics (Applesoft) and 
later basics (GFA, Quick etc.) had this feature.

So thank you Walter Bright for reinventing something that was 
unfortunately lost in time.


More information about the Digitalmars-d mailing list