From 9c532285f28b723a3f70fc4eba19e3856ecbd3dd Mon Sep 17 00:00:00 2001
From: dos-reis <gdr@axiomatics.org>
Date: Wed, 29 Dec 2010 03:20:55 +0000
Subject: SUBSTRING cleanup

---
 src/boot/includer.boot          |  12 ++---
 src/boot/scanner.boot           |  20 ++++----
 src/boot/strap/includer.clisp   |  14 +++---
 src/boot/strap/scanner.clisp    |  20 ++++----
 src/boot/strap/tokens.clisp     |  68 +++++++++++++++------------
 src/boot/strap/translator.clisp |   6 +--
 src/boot/tokens.boot            |   7 +++
 src/boot/translator.boot        |   6 +--
 src/interp/alql.boot            |   8 ++--
 src/interp/as.boot              |  14 +++---
 src/interp/bc-util.boot         |   6 +--
 src/interp/br-con.boot          |   2 +-
 src/interp/br-data.boot         |  28 +++++------
 src/interp/br-op1.boot          |   2 +-
 src/interp/br-op2.boot          |   2 +-
 src/interp/br-saturn.boot       |  40 ++++++++--------
 src/interp/br-search.boot       |  44 ++++++++---------
 src/interp/br-util.boot         |  12 ++---
 src/interp/c-doc.boot           | 102 ++++++++++++++++++++--------------------
 src/interp/database.boot        |   6 +--
 src/interp/format.boot          |   2 +-
 src/interp/functor.boot         |   8 ++--
 src/interp/g-util.boot          |   6 +--
 src/interp/guess.boot           |  10 ++--
 src/interp/ht-root.boot         |  22 ++++-----
 src/interp/ht-util.boot         |   6 +--
 src/interp/htcheck.boot         |   4 +-
 src/interp/i-output.boot        |  12 ++---
 src/interp/i-syscmd.boot        |  70 +++++++++++++--------------
 src/interp/i-util.boot          |   2 +-
 src/interp/incl.boot            |   8 ++--
 src/interp/int-top.boot         |   6 +--
 src/interp/interop.boot         |   2 +-
 src/interp/intfile.boot         |   2 +-
 src/interp/mark.boot            |   8 ++--
 src/interp/match.boot           |  24 +++++-----
 src/interp/msgdb.boot           |   6 +--
 src/interp/newfort.boot         |  16 +++----
 src/interp/osyscmd.boot         |   2 +-
 src/interp/pathname.boot        |   2 +-
 src/interp/pf2atree.boot        |   8 ++--
 src/interp/pf2sex.boot          |  10 ++--
 src/interp/pspad1.boot          |   4 +-
 src/interp/pspad2.boot          |   8 ++--
 src/interp/record.boot          |  10 ++--
 src/interp/scan.boot            |  20 ++++----
 src/interp/server.boot          |   2 +-
 src/interp/showimp.boot         |   2 +-
 src/interp/slam.boot            |   2 +-
 src/interp/sys-utility.boot     |   6 +++
 src/interp/topics.boot          |   4 +-
 src/interp/trace.boot           |   2 +-
 src/interp/word.boot            |  12 ++---
 53 files changed, 373 insertions(+), 354 deletions(-)

(limited to 'src')

diff --git a/src/boot/includer.boot b/src/boot/includer.boot
index 0e316b6f..3f976b28 100644
--- a/src/boot/includer.boot
+++ b/src/boot/includer.boot
@@ -86,7 +86,7 @@ shoeNotFound fn ==
 shoeReadLispString(s,n) ==
     l:=# s
     n >= l => nil
-    READ_-FROM_-STRING strconc ( "(", SUBSTRING(s,n,l-n) ,")")
+    READ_-FROM_-STRING strconc ( "(", subString(s,n,l-n) ,")")
 
 -- read a line from stream
 shoeReadLine stream ==
@@ -143,11 +143,11 @@ lineCharacter p ==
 shoePackageStartsAt (lines,sz,name,stream)==
   bStreamNull stream => [[],['nullstream]]
   a := CAAR stream
-  #a >= 8 and SUBSTRING(a,0,8)='")package" =>
+  #a >= 8 and subString(a,0,8)='")package" =>
     shoePackageStartsAt([CAAR stream,:lines],sz,name,rest stream)
   #a < sz =>
     shoePackageStartsAt(lines, sz,name,rest stream)
-  SUBSTRING(a,0,sz)=name and (#a>sz and not shoeIdChar(a.sz)) =>
+  subString(a,0,sz)=name and (#a>sz and not shoeIdChar(a.sz)) =>
     [lines,stream]
   shoePackageStartsAt(lines,sz,name,rest stream)
  
@@ -260,7 +260,7 @@ shoePrefix?(prefix,whole) ==
   good:=true
   for i in 0..#prefix-1 for j in 0.. while good repeat
     good:= prefix.i = whole.j
-  good => SUBSTRING(whole,#prefix,nil) 
+  good => subString(whole,#prefix) 
   good
  
 shoePlainLine?(s) ==
@@ -286,8 +286,8 @@ shoeBiteOff x==
   n:=STRPOSL('" ",x,0,true)
   n = nil =>  false
   n1:=STRPOSL ('" ",x,n,nil)
-  n1 = nil =>  [SUBSTRING(x,n,nil),'""]
-  [SUBSTRING(x,n,n1-n),SUBSTRING(x,n1,nil)]
+  n1 = nil =>  [subString(x,n),'""]
+  [subString(x,n,n1-n),subString(x,n1)]
  
 shoeFileName x==
   a:=shoeBiteOff x
diff --git a/src/boot/scanner.boot b/src/boot/scanner.boot
index 62e44f22..9745bae6 100644
--- a/src/boot/scanner.boot
+++ b/src/boot/scanner.boot
@@ -145,7 +145,7 @@ shoeAccumulateLines(s,string)==
       a:=STRPOS('";",command,0,nil)
       a=>
 	shoeAccumulateLines($r,
-	   strconc(string,SUBSTRING(command,0,a-1)))
+	   strconc(string,subString(command,0,a-1)))
       shoeAccumulateLines($r,strconc(string,command))
     shoeAccumulateLines($r,string)
   [s,:string]
@@ -280,12 +280,12 @@ shoeStartsNegComment()==
 shoeNegComment()==
   n := $n
   $n := $sz
-  shoeLeafNegComment SUBSTRING($ln,n,nil)
+  shoeLeafNegComment subString($ln,n)
  
 shoeComment()==
   n := $n
   $n := $sz
-  shoeLeafComment SUBSTRING($ln,n,nil)
+  shoeLeafComment subString($ln,n)
  
 shoePunct()==
   sss := shoeMatch($ln,$n)
@@ -329,11 +329,11 @@ shoeS()==
   mn=$sz =>
     $n:=$sz
     SoftShoeError([$linepos,:$n],'"quote added")
-    SUBSTRING($ln,n,nil)
+    subString($ln,n)
   mn = strsym =>
     $n:=mn+1
-    SUBSTRING($ln,n,mn-n)
-  str := SUBSTRING($ln,n,mn-n)
+    subString($ln,n,mn-n)
+  str := subString($ln,n,mn-n)
   $n := mn+1
   a := shoeEsc()
   b := 
@@ -363,8 +363,8 @@ shoeW(b)==
   endid := shoeIdEnd($ln,$n)
   endid=l or QENUM($ln,endid) ~= shoeESCAPE => 
     $n := endid
-    [b,SUBSTRING($ln,n1,endid-n1)]
-  str := SUBSTRING($ln,n1,endid-n1)
+    [b,subString($ln,n1,endid-n1)]
+  str := subString($ln,n1,endid-n1)
   $n := endid+1
   a := shoeEsc()
   bb := 
@@ -392,8 +392,8 @@ shoeInteger1(zro) ==
     $n := $n+1
   $n=l or QENUM($ln,$n)~=shoeESCAPE =>
     n = $n and zro => '"0"
-    SUBSTRING($ln,n,$n-n)
-  str := SUBSTRING($ln,n,$n-n)
+    subString($ln,n,$n-n)
+  str := subString($ln,n,$n-n)
   $n := $n+1
   a := shoeEsc()
   bb := shoeInteger1(zro)
diff --git a/src/boot/strap/includer.clisp b/src/boot/strap/includer.clisp
index 06904a5b..0956df6b 100644
--- a/src/boot/strap/includer.clisp
+++ b/src/boot/strap/includer.clisp
@@ -24,7 +24,7 @@
         (COND
           ((NOT (< |n| |l|)) NIL)
           (T (READ-FROM-STRING
-                 (CONCAT '|(| (SUBSTRING |s| |n| (- |l| |n|)) '|)|))))))))
+                 (CONCAT '|(| (|subString| |s| |n| (- |l| |n|)) '|)|))))))))
 
 (DEFUN |shoeReadLine| (|stream|) (READ-LINE |stream| NIL NIL))
 
@@ -90,13 +90,13 @@
         (T (SETQ |a| (CAAR |stream|))
            (COND
              ((AND (NOT (< (LENGTH |a|) 8))
-                   (STRING= (SUBSTRING |a| 0 8) ")package"))
+                   (STRING= (|subString| |a| 0 8) ")package"))
               (|shoePackageStartsAt| (CONS (CAAR |stream|) |lines|)
                   |sz| |name| (CDR |stream|)))
              ((< (LENGTH |a|) |sz|)
               (|shoePackageStartsAt| |lines| |sz| |name|
                   (CDR |stream|)))
-             ((AND (EQUAL (SUBSTRING |a| 0 |sz|) |name|)
+             ((AND (EQUAL (|subString| |a| 0 |sz|) |name|)
                    (< |sz| (LENGTH |a|))
                    (NOT (|shoeIdChar| (ELT |a| |sz|))))
               (LIST |lines| |stream|))
@@ -246,7 +246,7 @@
                (SETQ |i| (+ |i| 1))
                (SETQ |j| (+ |j| 1))))
            (COND
-             (|good| (SUBSTRING |whole| (LENGTH |prefix|) NIL))
+             (|good| (|subString| |whole| (LENGTH |prefix|)))
              (T |good|)))))))
 
 (DEFUN |shoePlainLine?| (|s|)
@@ -292,9 +292,9 @@
           ((NULL |n|) NIL)
           (T (SETQ |n1| (STRPOSL " " |x| |n| NIL))
              (COND
-               ((NULL |n1|) (LIST (SUBSTRING |x| |n| NIL) ""))
-               (T (LIST (SUBSTRING |x| |n| (- |n1| |n|))
-                        (SUBSTRING |x| |n1| NIL))))))))))
+               ((NULL |n1|) (LIST (|subString| |x| |n|) ""))
+               (T (LIST (|subString| |x| |n| (- |n1| |n|))
+                        (|subString| |x| |n1|))))))))))
 
 (DEFUN |shoeFileName| (|x|)
   (PROG (|c| |a|)
diff --git a/src/boot/strap/scanner.clisp b/src/boot/strap/scanner.clisp
index 1319d3c9..15ae2e96 100644
--- a/src/boot/strap/scanner.clisp
+++ b/src/boot/strap/scanner.clisp
@@ -146,7 +146,7 @@
                       (COND
                         (|a| (|shoeAccumulateLines| |$r|
                                  (CONCAT |string|
-                                         (SUBSTRING |command| 0
+                                         (|subString| |command| 0
                                           (- |a| 1)))))
                         (T (|shoeAccumulateLines| |$r|
                                (CONCAT |string| |command|)))))))
@@ -299,7 +299,7 @@
       (PROGN
         (SETQ |n| |$n|)
         (SETQ |$n| |$sz|)
-        (|shoeLeafNegComment| (SUBSTRING |$ln| |n| NIL))))))
+        (|shoeLeafNegComment| (|subString| |$ln| |n|))))))
 
 (DEFUN |shoeComment| ()
   (PROG (|n|)
@@ -308,7 +308,7 @@
       (PROGN
         (SETQ |n| |$n|)
         (SETQ |$n| |$sz|)
-        (|shoeLeafComment| (SUBSTRING |$ln| |n| NIL))))))
+        (|shoeLeafComment| (|subString| |$ln| |n|))))))
 
 (DEFUN |shoePunct| ()
   (PROG (|sss|)
@@ -366,10 +366,10 @@
            (COND
              ((EQUAL |mn| |$sz|) (SETQ |$n| |$sz|)
               (|SoftShoeError| (CONS |$linepos| |$n|) "quote added")
-              (SUBSTRING |$ln| |n| NIL))
+              (|subString| |$ln| |n|))
              ((EQUAL |mn| |strsym|) (SETQ |$n| (+ |mn| 1))
-              (SUBSTRING |$ln| |n| (- |mn| |n|)))
-             (T (SETQ |str| (SUBSTRING |$ln| |n| (- |mn| |n|)))
+              (|subString| |$ln| |n| (- |mn| |n|)))
+             (T (SETQ |str| (|subString| |$ln| |n| (- |mn| |n|)))
                 (SETQ |$n| (+ |mn| 1)) (SETQ |a| (|shoeEsc|))
                 (SETQ |b|
                       (COND
@@ -404,8 +404,8 @@
           ((OR (EQUAL |endid| |l|)
                (NOT (EQL (QENUM |$ln| |endid|) |shoeESCAPE|)))
            (SETQ |$n| |endid|)
-           (LIST |b| (SUBSTRING |$ln| |n1| (- |endid| |n1|))))
-          (T (SETQ |str| (SUBSTRING |$ln| |n1| (- |endid| |n1|)))
+           (LIST |b| (|subString| |$ln| |n1| (- |endid| |n1|))))
+          (T (SETQ |str| (|subString| |$ln| |n1| (- |endid| |n1|)))
              (SETQ |$n| (+ |endid| 1)) (SETQ |a| (|shoeEsc|))
              (SETQ |bb| (COND (|a| (|shoeW| T)) (T (LIST |b| ""))))
              (LIST (OR (ELT |bb| 0) |b|) (CONCAT |str| (ELT |bb| 1)))))))))
@@ -443,8 +443,8 @@
                (NOT (EQL (QENUM |$ln| |$n|) |shoeESCAPE|)))
            (COND
              ((AND (EQUAL |n| |$n|) |zro|) "0")
-             (T (SUBSTRING |$ln| |n| (- |$n| |n|)))))
-          (T (SETQ |str| (SUBSTRING |$ln| |n| (- |$n| |n|)))
+             (T (|subString| |$ln| |n| (- |$n| |n|)))))
+          (T (SETQ |str| (|subString| |$ln| |n| (- |$n| |n|)))
              (SETQ |$n| (+ |$n| 1)) (SETQ |a| (|shoeEsc|))
              (SETQ |bb| (|shoeInteger1| |zro|)) (CONCAT |str| |bb|)))))))
 
diff --git a/src/boot/strap/tokens.clisp b/src/boot/strap/tokens.clisp
index 45c988f4..01f54c47 100644
--- a/src/boot/strap/tokens.clisp
+++ b/src/boot/strap/tokens.clisp
@@ -15,6 +15,11 @@
   (OR (ALPHANUMERICP |x|)
       (MEMBER |x| (LIST (|char| '|'|) (|char| '?) (|char| '%)))))
 
+(DEFUN |subString| (|s| |f| &OPTIONAL (|n| NIL))
+  (COND
+    ((NULL |n|) (SUBSEQ |s| |f|))
+    (T (SUBSEQ |s| |f| (+ |f| |n|)))))
+
 (DEFCONSTANT |shoeKeyWords|
     (LIST (LIST "and" 'AND) (LIST "by" 'BY) (LIST "case" 'CASE)
           (LIST "catch" 'CATCH) (LIST "cross" 'CROSS)
@@ -47,14 +52,14 @@
     (RETURN
       (PROGN
         (SETQ |KeyTable| (MAKE-HASHTABLE 'CVEC))
-        (LET ((|bfVar#1| |shoeKeyWords|) (|st| NIL))
+        (LET ((|bfVar#2| |shoeKeyWords|) (|st| NIL))
           (LOOP
             (COND
-              ((OR (ATOM |bfVar#1|)
-                   (PROGN (SETQ |st| (CAR |bfVar#1|)) NIL))
+              ((OR (ATOM |bfVar#2|)
+                   (PROGN (SETQ |st| (CAR |bfVar#2|)) NIL))
                (RETURN NIL))
               (T (HPUT |KeyTable| (CAR |st|) (CADR |st|))))
-            (SETQ |bfVar#1| (CDR |bfVar#1|))))
+            (SETQ |bfVar#2| (CDR |bfVar#2|))))
         |KeyTable|))))
 
 (DEFPARAMETER |shoeKeyTable| (|shoeKeyTableCons|))
@@ -95,17 +100,17 @@
             ((< (LENGTH (ELT |u| |k|)) |l|) (RETURN NIL))
             (T (SETQ |k| (+ |k| 1)))))
         (SETQ |v| (MAKE-ARRAY (+ |n| 1)))
-        (LET ((|bfVar#2| (- |k| 1)) (|i| 0))
+        (LET ((|bfVar#3| (- |k| 1)) (|i| 0))
           (LOOP
             (COND
-              ((> |i| |bfVar#2|) (RETURN NIL))
+              ((> |i| |bfVar#3|) (RETURN NIL))
               (T (SETF (ELT |v| |i|) (ELT |u| |i|))))
             (SETQ |i| (+ |i| 1))))
         (SETF (ELT |v| |k|) |s|)
-        (LET ((|bfVar#3| (- |n| 1)) (|i| |k|))
+        (LET ((|bfVar#4| (- |n| 1)) (|i| |k|))
           (LOOP
             (COND
-              ((> |i| |bfVar#3|) (RETURN NIL))
+              ((> |i| |bfVar#4|) (RETURN NIL))
               (T (SETF (ELT |v| (+ |i| 1)) (ELT |u| |i|))))
             (SETQ |i| (+ |i| 1))))
         (SETF (ELT |d| |h|) |v|)
@@ -128,14 +133,14 @@
                       (T (SETF (ELT |a| |i|) |b|)))
                     (SETQ |i| (+ |i| 1))))
                 |a|))
-        (LET ((|bfVar#4| |l|) (|s| NIL))
+        (LET ((|bfVar#5| |l|) (|s| NIL))
           (LOOP
             (COND
-              ((OR (ATOM |bfVar#4|)
-                   (PROGN (SETQ |s| (CAR |bfVar#4|)) NIL))
+              ((OR (ATOM |bfVar#5|)
+                   (PROGN (SETQ |s| (CAR |bfVar#5|)) NIL))
                (RETURN NIL))
               (T (|shoeInsert| |s| |d|)))
-            (SETQ |bfVar#4| (CDR |bfVar#4|))))
+            (SETQ |bfVar#5| (CDR |bfVar#5|))))
         |d|))))
 
 (DEFPARAMETER |shoeDict| (|shoeDictCons|))
@@ -152,31 +157,31 @@
               ((> |i| 255) (RETURN NIL))
               (T (BVEC-SETELT |a| |i| 0)))
             (SETQ |i| (+ |i| 1))))
-        (LET ((|bfVar#5| |listing|) (|k| NIL))
+        (LET ((|bfVar#6| |listing|) (|k| NIL))
           (LOOP
             (COND
-              ((OR (ATOM |bfVar#5|)
-                   (PROGN (SETQ |k| (CAR |bfVar#5|)) NIL))
+              ((OR (ATOM |bfVar#6|)
+                   (PROGN (SETQ |k| (CAR |bfVar#6|)) NIL))
                (RETURN NIL))
               (T (COND
                    ((NOT (|shoeStartsId| (ELT |k| 0)))
                     (BVEC-SETELT |a| (QENUM |k| 0) 1)))))
-            (SETQ |bfVar#5| (CDR |bfVar#5|))))
+            (SETQ |bfVar#6| (CDR |bfVar#6|))))
         |a|))))
 
 (DEFPARAMETER |shoePun| (|shoePunCons|))
 
 (EVAL-WHEN (:EXECUTE :LOAD-TOPLEVEL)
-  (LET ((|bfVar#6| (LIST 'NOT 'LENGTH)) (|i| NIL))
+  (LET ((|bfVar#7| (LIST 'NOT 'LENGTH)) (|i| NIL))
     (LOOP
       (COND
-        ((OR (ATOM |bfVar#6|) (PROGN (SETQ |i| (CAR |bfVar#6|)) NIL))
+        ((OR (ATOM |bfVar#7|) (PROGN (SETQ |i| (CAR |bfVar#7|)) NIL))
          (RETURN NIL))
         (T (SETF (GET |i| 'SHOEPRE) T)))
-      (SETQ |bfVar#6| (CDR |bfVar#6|)))))
+      (SETQ |bfVar#7| (CDR |bfVar#7|)))))
 
 (EVAL-WHEN (:EXECUTE :LOAD-TOPLEVEL)
-  (LET ((|bfVar#7| (LIST (LIST 'SHOEEQ '=) (LIST 'TIMES '*)
+  (LET ((|bfVar#8| (LIST (LIST 'SHOEEQ '=) (LIST 'TIMES '*)
                          (LIST 'REM '|rem|) (LIST 'QUO '|quo|)
                          (LIST 'PLUS '+) (LIST 'IS '|is|)
                          (LIST 'ISNT '|isnt|) (LIST 'AND '|and|)
@@ -187,13 +192,13 @@
         (|i| NIL))
     (LOOP
       (COND
-        ((OR (ATOM |bfVar#7|) (PROGN (SETQ |i| (CAR |bfVar#7|)) NIL))
+        ((OR (ATOM |bfVar#8|) (PROGN (SETQ |i| (CAR |bfVar#8|)) NIL))
          (RETURN NIL))
         (T (SETF (GET (CAR |i|) 'SHOEINF) (CADR |i|))))
-      (SETQ |bfVar#7| (CDR |bfVar#7|)))))
+      (SETQ |bfVar#8| (CDR |bfVar#8|)))))
 
 (EVAL-WHEN (:EXECUTE :LOAD-TOPLEVEL)
-  (LET ((|bfVar#8|
+  (LET ((|bfVar#9|
             (LIST (LIST '+ 0) (LIST '|gcd| 0) (LIST '|lcm| 1)
                   (LIST 'STRCONC "") (LIST '|strconc| "")
                   (LIST 'CONCAT "") (LIST 'MAX (- 999999))
@@ -206,13 +211,13 @@
         (|i| NIL))
     (LOOP
       (COND
-        ((OR (ATOM |bfVar#8|) (PROGN (SETQ |i| (CAR |bfVar#8|)) NIL))
+        ((OR (ATOM |bfVar#9|) (PROGN (SETQ |i| (CAR |bfVar#9|)) NIL))
          (RETURN NIL))
         (T (SETF (GET (CAR |i|) 'SHOETHETA) (CDR |i|))))
-      (SETQ |bfVar#8| (CDR |bfVar#8|)))))
+      (SETQ |bfVar#9| (CDR |bfVar#9|)))))
 
 (EVAL-WHEN (:EXECUTE :LOAD-TOPLEVEL)
-  (LET ((|bfVar#9|
+  (LET ((|bfVar#10|
             (LIST (LIST '|abs| 'ABS) (LIST '|abstractChar| 'CODE-CHAR)
                   (LIST '|alphabetic?| 'ALPHA-CHAR-P)
                   (LIST '|alphanumeric?| 'ALPHANUMERICP)
@@ -248,6 +253,7 @@
                   (LIST '|setIntersection| 'INTERSECTION)
                   (LIST '|setPart| 'SETELT) (LIST '|setUnion| 'UNION)
                   (LIST '|strconc| 'CONCAT) (LIST '|string?| 'STRINGP)
+                  (LIST '|subSequence| 'SUBSEQ)
                   (LIST '|substitute| 'SUBST)
                   (LIST '|substitute!| 'NSUBST)
                   (LIST '|symbol?| 'SYMBOLP)
@@ -266,13 +272,13 @@
         (|i| NIL))
     (LOOP
       (COND
-        ((OR (ATOM |bfVar#9|) (PROGN (SETQ |i| (CAR |bfVar#9|)) NIL))
+        ((OR (ATOM |bfVar#10|) (PROGN (SETQ |i| (CAR |bfVar#10|)) NIL))
          (RETURN NIL))
         (T (SETF (GET (CAR |i|) 'SHOERENAME) (CDR |i|))))
-      (SETQ |bfVar#9| (CDR |bfVar#9|)))))
+      (SETQ |bfVar#10| (CDR |bfVar#10|)))))
 
 (EVAL-WHEN (:EXECUTE :LOAD-TOPLEVEL)
-  (LET ((|bfVar#10| (LIST (LIST '|setName| 0) (LIST '|setLabel| 1)
+  (LET ((|bfVar#11| (LIST (LIST '|setName| 0) (LIST '|setLabel| 1)
                           (LIST '|setLevel| 2) (LIST '|setType| 3)
                           (LIST '|setVar| 4) (LIST '|setLeaf| 5)
                           (LIST '|setDef| 6) (LIST '|aGeneral| 4)
@@ -301,8 +307,8 @@
         (|i| NIL))
     (LOOP
       (COND
-        ((OR (ATOM |bfVar#10|) (PROGN (SETQ |i| (CAR |bfVar#10|)) NIL))
+        ((OR (ATOM |bfVar#11|) (PROGN (SETQ |i| (CAR |bfVar#11|)) NIL))
          (RETURN NIL))
         (T (SETF (GET (CAR |i|) 'SHOESELFUNCTION) (CADR |i|))))
-      (SETQ |bfVar#10| (CDR |bfVar#10|)))))
+      (SETQ |bfVar#11| (CDR |bfVar#11|)))))
 
diff --git a/src/boot/strap/translator.clisp b/src/boot/strap/translator.clisp
index 51bfd7d4..e37043e5 100644
--- a/src/boot/strap/translator.clisp
+++ b/src/boot/strap/translator.clisp
@@ -725,7 +725,7 @@
     (RETURN
       (PROGN
         (SETQ |n| (SEARCH |str| |s| :FROM-END T))
-        (COND ((NULL |n|) |s|) (T (SUBSTRING |s| 0 |n|)))))))
+        (COND ((NULL |n|) |s|) (T (|subString| |s| 0 |n|)))))))
 
 (DEFUN DEFUSE (|fn|)
   (PROG (|infn|)
@@ -1087,7 +1087,7 @@
                   (|shoeFindName2| |fn| |name| |a|)))
         (SETQ |filename|
               (COND
-                ((< 8 (LENGTH |name|)) (SUBSTRING |name| 0 8))
+                ((< 8 (LENGTH |name|)) (|subString| |name| 0 8))
                 (T |name|)))
         (COND (|a| (FUNCALL |f| (CONCAT "/tmp/" |filename|))) (T NIL))))))
 
@@ -1100,7 +1100,7 @@
           (|lines| (SETQ |filename|
                          (COND
                            ((< 8 (LENGTH |name|))
-                            (SUBSTRING |name| 0 8))
+                            (|subString| |name| 0 8))
                            (T |name|)))
                    (SETQ |filename|
                          (CONCAT "/tmp/" |filename| ".boot"))
diff --git a/src/boot/tokens.boot b/src/boot/tokens.boot
index 08b5854c..6247a0b3 100644
--- a/src/boot/tokens.boot
+++ b/src/boot/tokens.boot
@@ -46,6 +46,12 @@ shoeStartsId x ==
 shoeIdChar x ==
   alphanumeric? x or x in [char "'", char "?", char "%"]
 
+++ return the sub-string of `s' starting from `f'.
+++ When non-nil, `n' designates the length of the sub-string.
+subString(s,f,n == nil) ==
+  n = nil => subSequence(s,f)
+  subSequence(s,f,f + n)
+
 ++ Table of Boot keywords and their token name.
 shoeKeyWords == [  _
             ['"and","AND"] , _
@@ -307,6 +313,7 @@ for i in [ _
   ["setUnion",   "UNION"]  , _
   ["strconc",  "CONCAT"]  , _
   ["string?",  "STRINGP"]  ,_
+  ["subSequence", "SUBSEQ"] , _
   ["substitute",  "SUBST"]  , _
   ["substitute!", "NSUBST"]  , _
   ["symbol?",  "SYMBOLP"]  , _
diff --git a/src/boot/translator.boot b/src/boot/translator.boot
index 085e6755..c8d9452f 100644
--- a/src/boot/translator.boot
+++ b/src/boot/translator.boot
@@ -473,7 +473,7 @@ shoeAddStringIfNec(str,s)==
 shoeRemoveStringIfNec(str,s)==
   n := SEARCH(str,s,KEYWORD::FROM_-END,true)
   n = nil => s
-  SUBSTRING(s,0,n)
+  subString(s,0,n)
  
 -- DEFUSE prints the definitions not used and the words used and
 -- not defined in the input file and common lisp.
@@ -634,14 +634,14 @@ shoeGeneralFC(f,name,fn)==
    $GenVarCounter  := 0
    infn:=shoeAddbootIfNec fn
    a:= shoeOpenInputFile(a,infn,shoeFindName2(fn,name, a))
-   filename:= if # name > 8 then SUBSTRING(name,0,8) else name
+   filename:= if # name > 8 then subString(name,0,8) else name
    a =>  FUNCALL(f, strconc('"/tmp/",filename))
    nil
  
 shoeFindName2(fn,name,a)==
   lines:=shoeFindLines(fn,name,a)
   lines =>
-    filename:= if # name > 8 then SUBSTRING(name,0,8) else name
+    filename:= if # name > 8 then subString(name,0,8) else name
     filename := strconc('"/tmp/",filename,'".boot")
     shoeOpenOutputFile(stream, filename,
 	 for line in lines repeat shoeFileLine (line,stream))
diff --git a/src/interp/alql.boot b/src/interp/alql.boot
index 56358a87..0ab02f07 100644
--- a/src/interp/alql.boot
+++ b/src/interp/alql.boot
@@ -44,16 +44,16 @@ stringMatches?(pattern,subject) ==
   FIXP basicMatch?(pattern,subject) => true
   false
 alqlGetKindString(x) ==
-  x.0 = char 'a or x.0 = char 'o => SUBSTRING(dbPart(x,5,1),0,1)
-  SUBSTRING(x,0,1)
+  x.0 = char 'a or x.0 = char 'o => subString(dbPart(x,5,1),0,1)
+  subString(x,0,1)
 alqlGetOrigin(x) ==
   field :=dbPart(x,5,1)
   k := charPosition(char '_(,field,2)
-  SUBSTRING(field,1,k-1)
+  subString(field,1,k-1)
 alqlGetParams(x) ==
   field :=dbPart(x,5,1)
   k := charPosition(char '_(,field,2)
-  SUBSTRING(field,k,nil)
+  subString(field,k,nil)
 
 
 
diff --git a/src/interp/as.boot b/src/interp/as.boot
index b21ad225..b64de57f 100644
--- a/src/interp/as.boot
+++ b/src/interp/as.boot
@@ -313,14 +313,14 @@ asyDocumentation con ==
   [:u,['constructor,[nil,comments]]]
 
 asyExtractDescription str ==
-  k := STRPOS('"Description:",str,0,nil) => asyExtractDescription SUBSTRING(str,k + 12,nil)
-  k := STRPOS('"Author:",str,0,nil) => asyExtractDescription SUBSTRING(str,0,k)
+  k := STRPOS('"Description:",str,0,nil) => asyExtractDescription subString(str,k + 12)
+  k := STRPOS('"Author:",str,0,nil) => asyExtractDescription subString(str,0,k)
   str
 
 trimComments str ==
   str = nil or str = '"" => '""
   m := MAXINDEX str
-  str := SUBSTRING(str,0,m)
+  str := subString(str,0,m)
   trimString str
 
 asyExportAlist con ==
@@ -705,7 +705,7 @@ asyAbbreviation(id,n) ==  chk(id,main) where   --> n = number of arguments
     parts := asySplit(name,MAXINDEX name)
     newname := strconc/[asyShorten x for x in parts]
     #newname < 8 => INTERN newname
-    tryname := SUBSTRING(name,0,7)
+    tryname := subString(name,0,7)
     not createAbbreviation tryname => INTERN UPCASE tryname
     nil
   chk(conname,abb) ==
@@ -731,9 +731,9 @@ asyGetAbbrevFromComments con ==
 
 asyExtractAbbreviation str ==
         not (k:= STRPOS('"Abbrev: ",str,0,nil)) => NIL
-        str := SUBSTRING(str, k+8, nil)
+        str := subString(str, k+8)
         k := STRPOS($stringNewline, str,0,nil)
-        k => SUBSTRING(str, 0, k)
+        k => subString(str, 0, k)
         str
 
 asyShorten x ==
@@ -750,7 +750,7 @@ asySplit(name,end) ==
   k := 0
   for i in 1..end while lowerCase? name.i repeat k := i
   k := k + 1
-  [SUBSTRING(name,0,k),:asySplit(SUBSTRING(name,k,nil),end-k)]
+  [subString(name,0,k),:asySplit(subString(name,k),end-k)]
 
 createAbbreviation s ==
   if string? s then s := INTERN s
diff --git a/src/interp/bc-util.boot b/src/interp/bc-util.boot
index e542e9b3..6c2531dc 100644
--- a/src/interp/bc-util.boot
+++ b/src/interp/bc-util.boot
@@ -52,7 +52,7 @@ bcMkFunction(name,arg,args) ==
 bcString2HyString2 s ==
   (string? s) and (s.0 = char '_")  =>
     len := #s
-    strconc('"\_"", SUBSTRING(s, 1, len-2), '"\_"")
+    strconc('"\_"", subString(s, 1, len-2), '"\_"")
   s
 
 bcString2HyString s == s
@@ -99,8 +99,8 @@ bcString2WordList s == fn(s,0,MAXINDEX s) where
     k := or/[j for j in i..n | s.j ~= char '_  ]
     null integer? k => nil
     l := bcFindString(s,k + 1,n,char '_  )
-    null integer? l => [SUBSTRING(s,k,nil)]
-    [SUBSTRING(s,k,l-k),:fn(s,l + 1,n)]
+    null integer? l => [subString(s,k)]
+    [subString(s,k,l-k),:fn(s,l + 1,n)]
 
 
 bcwords2liststring u ==
diff --git a/src/interp/br-con.boot b/src/interp/br-con.boot
index 9c2ff3f7..6ac7cef4 100644
--- a/src/interp/br-con.boot
+++ b/src/interp/br-con.boot
@@ -175,7 +175,7 @@ kdPageInfo(name,abbrev,nargs,conform,signature,file?) ==
   htSayStandard '"\indentrel{2}"
   if nargs > 0 then kPageArgs(conform,signature)
   htSayStandard '"\indentrel{-2}"
-  if name.(#name-1) = char "&" then name := SUBSEQ(name, 0, #name-1)
+  if name.(#name-1) = char "&" then name := subSequence(name, 0, #name-1)
 --sourceFileName := dbSourceFile INTERN name
   sourceFileName := getConstructorSourceFileFromDB INTERN name
   filename := extractFileNameFromPath sourceFileName
diff --git a/src/interp/br-data.boot b/src/interp/br-data.boot
index 0ff40dcd..b63560da 100644
--- a/src/interp/br-data.boot
+++ b/src/interp/br-data.boot
@@ -118,7 +118,7 @@ buildLibdbConEntry conname ==
     conComments :=
       LASSOC('constructor,$doc) is [[=nil,:r]] => libdbTrim concatWithBlanks r
       '""
-    argpart:= SUBSTRING(form2HtString ['f,:argl],1,nil)
+    argpart:= subString(form2HtString ['f,:argl],1)
     sigpart:= libConstructorSig $conform
     header := strconc($kind,PNAME conname)
     buildLibdbString [header,#argl,$exposed?,sigpart,argpart,abb,conComments]
@@ -161,8 +161,8 @@ writedb(u) ==
   TERPRI $outStream
 
 addPatchesToLongLines(s,n) ==
-  #s > n => strconc(SUBSTRING(s,0,n),
-              addPatchesToLongLines(strconc('"--",SUBSTRING(s,n,nil)),n))
+  #s > n => strconc(subString(s,0,n),
+              addPatchesToLongLines(strconc('"--",subString(s,n)),n))
   s
 
 buildLibOps oplist == for [op,sig,:pred] in oplist repeat buildLibOp(op,sig,pred)
@@ -216,7 +216,7 @@ buildLibAttrs attrlist ==
 buildLibAttr(name,argl,pred) ==
 --attributes      AKname\#\args\conname\pred\comments (K is U or C)
   header := strconc('"a",STRINGIMAGE name)
-  argPart:= SUBSTRING(form2LispString ['f,:argl],1,nil)
+  argPart:= subString(form2LispString ['f,:argl],1)
   pred := SUBLISLIS(rest $conform,$FormalMapVariableList,pred)
   predString := (pred = 'T => '""; form2LispString pred)
   header := strconc('"a",STRINGIMAGE name)
@@ -263,11 +263,11 @@ dbReadComments(n) ==
   FILE_-POSITION(instream,n)
   line := READLINE instream
   k := dbTickIndex(line,1,1)
-  line := SUBSTRING(line,k + 1,nil)
+  line := subString(line,k + 1)
   while not EOFP instream and (x := READLINE instream) and
     (k := MAXINDEX x) and (j := dbTickIndex(x,1,1)) and (j < k) and
       x.(j := j + 1) = char '_- and x.(j := j + 1) = char '_- repeat
-        xtralines := [SUBSTRING(x,j + 1,nil),:xtralines]
+        xtralines := [subString(x,j + 1),:xtralines]
   SHUT instream
   strconc(line, strconc/nreverse xtralines)
 
@@ -307,17 +307,17 @@ dbSplitLibdb() ==
 
 dbSplit(line,n,k) ==
   k := charPosition($tick,line,k + 1)
-  n = 1 => [SUBSTRING(line,0,k),:dbSpreadComments(SUBSTRING(line,k + 1,nil),0)]
+  n = 1 => [subString(line,0,k),:dbSpreadComments(subString(line,k + 1),0)]
   dbSplit(line,n - 1,k)
 
 dbSpreadComments(line,n) ==
   line = '"" => nil
   k := charPosition(char '_-,line,n + 2)
-  k >= MAXINDEX line => [SUBSTRING(line,n,nil)]
+  k >= MAXINDEX line => [subString(line,n)]
   line.(k + 1) ~= char '_- =>
     u := dbSpreadComments(line,k)
-    [strconc(SUBSTRING(line,n,k - n),first u),:rest u]
-  [SUBSTRING(line,n,k - n),:dbSpreadComments(SUBSTRING(line,k,nil),0)]
+    [strconc(subString(line,n,k - n),first u),:rest u]
+  [subString(line,n,k - n),:dbSpreadComments(subString(line,k),0)]
 
 --============================================================================
 --                  Build Glossary
@@ -380,7 +380,7 @@ spreadGlossText(line) ==
 --where XXX is the file position of key1
 --this is because grepping will only pick up the first 512 characters
   line = '"" => nil
-  MAXINDEX line > 500 => [SUBSTRING(line,0,500),:spreadGlossText(SUBSTRING(line,500,nil))]
+  MAXINDEX line > 500 => [subString(line,0,500),:spreadGlossText(subString(line,500))]
   [line]
 
 getGlossLines instream ==
@@ -409,8 +409,8 @@ getGlossLines instream ==
       lastLineHadTick := false
       text := [strconc(last,fill,line),:rest text]
     lastLineHadTick := true
-    keys := [SUBSTRING(line,0,n),:keys]
-    text := [SUBSTRING(line,n + 1,nil),:text]
+    keys := [subString(line,0,n),:keys]
+    text := [subString(line,n + 1),:text]
   ASSOCRIGHT listSort(function GLESSEQP,[[DOWNCASE key,key,:def] for key in keys for def in text])
   --this complication sorts them after lower casing the keys
 
@@ -433,7 +433,7 @@ mkUsersHashTable() ==  --called by buildDatabase (database.boot)
   $usersTb
 
 getDefaultPackageClients con ==  --called by mkUsersHashTable
-  catname := INTERN SUBSTRING(s := PNAME con,0,MAXINDEX s)
+  catname := INTERN subString(s := PNAME con,0,MAXINDEX s)
   for [catAncestor,:.] in childrenOf([catname]) repeat
     pakname := INTERN strconc(PNAME catAncestor,'"&")
     if getCDTEntry(pakname,true) then acc := [pakname,:acc]
diff --git a/src/interp/br-op1.boot b/src/interp/br-op1.boot
index 2740fb17..c3ea7a5a 100644
--- a/src/interp/br-op1.boot
+++ b/src/interp/br-op1.boot
@@ -846,7 +846,7 @@ dbExpandOpAlistIfNecessary(htPage,opAlist,which,needOrigins?,condition?) ==
       packageSymbol := false
       domform := htpProperty(htPage,'domname) or htpProperty(htPage,'conform)
       if isDefaultPackageName opOf domform then
-         catname := intern SUBSTRING(s := PNAME opOf domform,0,MAXINDEX s)
+         catname := intern subString(s := PNAME opOf domform,0,MAXINDEX s)
          packageSymbol := second domform
          domform := [catname,:rest rest domform]  --skip first argument ($)
       docTable:= dbDocTable domform
diff --git a/src/interp/br-op2.boot b/src/interp/br-op2.boot
index 3eff1ceb..3dc6086a 100644
--- a/src/interp/br-op2.boot
+++ b/src/interp/br-op2.boot
@@ -149,7 +149,7 @@ dbGetFormFromDocumentation(op,sig,x) ==
      (stringPrefix?('"\spad{",doc) and (k := 6) or
        stringPrefix?('"\s{",doc) and (k := 3)) =>
     n := charPosition($charRbrace,doc,k)
-    s := SUBSTRING(doc,k,n - k)
+    s := subString(doc,k,n - k)
     parse := ncParseFromString s
     parse is [=op,:.] and #parse = #sig => parse
   nil
diff --git a/src/interp/br-saturn.boot b/src/interp/br-saturn.boot
index 362aee5d..3807efaa 100644
--- a/src/interp/br-saturn.boot
+++ b/src/interp/br-saturn.boot
@@ -249,33 +249,33 @@ writeSaturn(line) ==
       true
     repeat (k := k + 1)
   k > n => writeSaturnPrint(line)
-  segment := SUBSTRING(line,0,k)
+  segment := subString(line,0,k)
   writeSaturnPrint(segment)
   code = 1 =>
     writeSaturnPrint('"\\")
-    writeSaturn SUBSTRING(line,k + 2, nil)
+    writeSaturn subString(line,k + 2)
   code = 2 =>
     writeSaturnPrint('"  &")
-    writeSaturn SUBSTRING(line,k + 4, nil)
+    writeSaturn subString(line,k + 4)
   code = 3 =>
     writeSaturnPrint('"\item")
-    writeSaturn SUBSTRING(line,k + 5,nil)
+    writeSaturn subString(line,k + 5)
   code = 4 =>
     writeSaturnPrint('"\newline")
-    writeSaturn SUBSTRING(line,k + 8,nil)
+    writeSaturn subString(line,k + 8)
   code = 5 =>
     writeSaturnPrint('"\table{")
     $marg := $marg + 3
-    writeSaturnTable SUBSTRING(line,k + 7,nil)
+    writeSaturnTable subString(line,k + 7)
   code = 6 =>
     i := charPosition(char '_},line,k + 4)
-    tabCode := SUBSTRING(line,k, i - k + 1)
+    tabCode := subString(line,k, i - k + 1)
     writeSaturnPrint tabCode
-    line := SUBSTRING(line,i + 1, nil)
+    line := subString(line,i + 1)
     writeSaturn line
   code = 7 =>
     saturnTERPRI()
-    writeSaturn SUBSTRING(line, k + 2,nil)
+    writeSaturn subString(line, k + 2)
   code = 8 =>
     i :=
       substring?('"\beginmenu",  line,k) => k + 9
@@ -283,18 +283,18 @@ writeSaturn(line) ==
       charPosition(char '_},line,k)
     if char '_[ = line.(i + 1) then
       i := charPosition(char '_], line, i + 2)
-    beginCode := SUBSTRING(line,k, i - k + 1)
+    beginCode := subString(line,k, i - k + 1)
     writeSaturnPrint(beginCode)
-    line := SUBSTRING(line,i + 1,nil)
+    line := subString(line,i + 1)
     writeSaturn line
   code = 9 =>
     i :=
       substring?('"\endmenu",line,k)   => k + 7
       substring?('"\endscroll",line,k) => k + 9
       charPosition(char '_},line,k)
-    endCode := SUBSTRING(line,k, i - k + 1)
+    endCode := subString(line,k, i - k + 1)
     writeSaturnPrint(endCode)
-    line := SUBSTRING(line,i + 1,nil)
+    line := subString(line,i + 1)
     $marg := $marg - 3
     writeSaturn line
   systemError code
@@ -346,11 +346,11 @@ writeSaturnTable line ==
   close:= charPosition(char "}",line,0)
   open < close =>
     close := findBalancingBrace(line,open + 1,MAXINDEX line,0) or error '"no balancing brace"
-    writeSaturnPrint SUBSTRING(line,0,close + 1)
-    writeSaturnTable SUBSTRING(line,close + 1,nil)
+    writeSaturnPrint subString(line,0,close + 1)
+    writeSaturnTable subString(line,close + 1)
   $marg := $marg - 3
-  writeSaturnPrint SUBSTRING(line,0,close + 1)
-  writeSaturn SUBSTRING(line, close + 1,nil)
+  writeSaturnPrint subString(line,0,close + 1)
+  writeSaturn subString(line, close + 1)
 
 findBalancingBrace(s,k,n,level) ==
   k > n => nil
@@ -454,7 +454,7 @@ saturnTranText x ==
   error nil
 
 isMenuItemStyle? s ==
-  15 = STRING_<('"\menuitemstyle{", s) => SUBSTRING(s,15,(MAXINDEX s) - 15)
+  15 = STRING_<('"\menuitemstyle{", s) => subString(s,15,(MAXINDEX s) - 15)
   nil
 
 getCallBack callTail ==
@@ -1500,7 +1500,7 @@ unTab s ==
 
 unTab1 s ==
   STRING_<('"\tab{", s) = 5 and (k := charPosition(char '_}, s, 4)) =>
-      SUBSTRING(s, k + 1, nil)
+      subString(s, k + 1)
   s
 
 satBreak() ==
@@ -1721,7 +1721,7 @@ screenLocalLine(line, conlist) ==
     k = char 'o or k = char 'a =>
       s := dbPart(line,5,1)
       k := charPosition(char '_(,s,1)
-      SUBSTRING(s,1,k - 1)
+      subString(s,1,k - 1)
     dbName line
   MEMQ(con, conlist)
 
diff --git a/src/interp/br-search.boot b/src/interp/br-search.boot
index 6e68d9a6..b17045a2 100644
--- a/src/interp/br-search.boot
+++ b/src/interp/br-search.boot
@@ -184,7 +184,7 @@ pmPreparse s == hn fn(s,0,#s) where--stupid insertion of chars to get correct pa
   hn x == SUBLISLIS('(and or not),'("and" "or" "not"),x)
   fn(s,n,siz) ==  --main function: s is string, n is origin
     n = siz => '""
-    i := firstNonDelim(s,n) or return SUBSTRING(s,n,nil)
+    i := firstNonDelim(s,n) or return subString(s,n)
     j := firstDelim(s,i + 1) or siz
     t := gn(s,i,j - 1)
     middle :=
@@ -193,11 +193,11 @@ pmPreparse s == hn fn(s,0,#s) where--stupid insertion of chars to get correct pa
       t.0 = char '_" => t
       j < siz - 1 and s.j = char '_( => t
       strconc('"_"",t,'"_"")
-    strconc(SUBSTRING(s,n,i - n),middle,fn(s,j,siz))
+    strconc(subString(s,n,i - n),middle,fn(s,j,siz))
   gn(s,i,j) ==    --replace each underscore by 4 underscores!
     n := or/[k for k in i..j | s.k = $charUnderscore] =>
-      strconc(SUBSTRING(s,i,n - i + 1),$charUnderscore,gn(s,n + 1,j))
-    SUBSTRING(s,i,j - i + 1)
+      strconc(subString(s,i,n - i + 1),$charUnderscore,gn(s,n + 1,j))
+    subString(s,i,j - i + 1)
 
 firstNonDelim(s,n) ==  or/[k for k in n..MAXINDEX s | not isFilterDelimiter? s.k]
 firstDelim(s,n) ==  or/[k for k in n..MAXINDEX s | isFilterDelimiter? s.k]
@@ -259,8 +259,8 @@ mkGrepPattern1(x,:options) == --called by mkGrepPattern (and grepConstructName?)
       h(sl,nil)
     g s  ==    --remove "*"s around pattern for text match
       not ('w in $options) => s
-      if s.0 = char '_* then s := SUBSTRING(s,1,nil)
-      if s.(k := MAXINDEX s) = char '_* then s := SUBSTRING(s,0,k)
+      if s.0 = char '_* then s := subString(s,1)
+      if s.(k := MAXINDEX s) = char '_* then s := subString(s,0,k)
       s
     h(sl,res) == --helper for wild cards
       sl is [s,:r] => h(r,[$wild1,s,:res])
@@ -271,13 +271,13 @@ mkGrepPattern1(x,:options) == --called by mkGrepPattern (and grepConstructName?)
       strconc/nreverse res
     remUnderscores s ==
       (k := charPosition(char $charUnderscore,s,0)) < MAXINDEX s =>
-        strconc(SUBSTRING(s,0,k),'"[",s.(k + 1),'"]",
-                remUnderscores(SUBSTRING(s,k + 2,nil)))
+        strconc(subString(s,0,k),'"[",s.(k + 1),'"]",
+                remUnderscores(subString(s,k + 2)))
       s
     split(s,char) ==
       max := MAXINDEX s + 1
       f := -1
-      [SUBSTRING(s,i,f-i)
+      [subString(s,i,f-i)
         while ((i := f + 1) <= max) and (f := charPosition(char,s,i))]
     charPosition(c,t,startpos) ==  --honors underscores
       n := # t
@@ -369,7 +369,7 @@ looksLikeDomainForm x ==
 
 spadSys(x) ==   --called by \spadsyscom{x}
   s := PNAME x
-  if s.0 = char '_) then s := SUBSTRING(s,1,nil)
+  if s.0 = char '_) then s := subString(s,1)
   form := ncParseFromString s or
            systemError ['"Argument: ",s,'" to spadType won't parse"]
   htSystemCommands PNAME opOf form
@@ -527,7 +527,7 @@ genSearchUniqueCount(u) ==
       lastid := id
   count
 
-dbGetName line == SUBSTRING(line,1,charPosition($tick,line,1) - 1)
+dbGetName line == subString(line,1,charPosition($tick,line,1) - 1)
 
 pluralSay(count,singular,plural,:options) ==
   item := (options is [x,:options] => x; '"")
@@ -570,8 +570,8 @@ docSearch1(filter,doc) ==
 
 removeSurroundingStars filter ==
   key := STRINGIMAGE filter
-  if key.0 = char '_* then key := SUBSTRING(key,1,nil)
-  if key.(max := MAXINDEX key) = char '_* then key := SUBSTRING(key,0,max)
+  if key.0 = char '_* then key := subString(key,1)
+  if key.(max := MAXINDEX key) = char '_* then key := subString(key,0,max)
   key
 
 showNamedDoc([kind,:lines],index) ==
@@ -594,7 +594,7 @@ stripOffSegments(s,n) ==
   while n > 0 and progress = true repeat
     n := n - 1
     k := charPosition(char '_`,s,0)
-    new := SUBSTRING(s,k + 1,nil)
+    new := subString(s,k + 1)
     #new < #s => s := new
     progress := false
   n = 0 => s
@@ -884,7 +884,7 @@ mkDetailedGrepPattern(kind,name,nargs,argOrSig) == main where
     m > 6 and a.(m-5) = char '_[ and a.(m-4) = char "^"
       and     a.(m-3) = $tick    and a.(m-2) = char '_]
           and a.(m-1) = char '_* and a.m = $tick
-            => simp SUBSTRING(a,0,m-5)
+            => simp subString(a,0,m-5)
     a
 
 replaceGrepStar s ==
@@ -892,19 +892,19 @@ replaceGrepStar s ==
   final := MAXINDEX s
   i := charPosition(char '_*,s,0)
   i > final => s
-  strconc(SUBSTRING(s,0,i),'"[^`]*",replaceGrepStar SUBSTRING(s,i + 1,nil))
+  strconc(subString(s,0,i),'"[^`]*",replaceGrepStar subString(s,i + 1))
 
 standardizeSignature(s) == underscoreDollars
   s.0 = char '_( => s
   k := STRPOS('"->",s,0,nil) or return s --will fail except perhaps on constants
   s.(k - 1) = char '_) => strconc('"(",s)
-  strconc('"(",SUBSTRING(s,0,k),'")",SUBSTRING(s,k,nil))
+  strconc('"(",subString(s,0,k),'")",subString(s,k))
 
 underscoreDollars(s) == fn(s,0,MAXINDEX s) where
   fn(s,i,n) ==
     i > n => '""
-    (m := charPosition(char '_$,s,i)) > n => SUBSTRING(s,i,nil)
-    strconc(SUBSTRING(s,i,m - i),'"___$",fn(s,m + 1,n))
+    (m := charPosition(char '_$,s,i)) > n => subString(s,i)
+    strconc(subString(s,i,m - i),'"___$",fn(s,m + 1,n))
 
 --=======================================================================
 --                         I/O Code
@@ -933,8 +933,8 @@ dbGetCommentOrigin line ==
 --Comment lines have format  [dcpxoa]xxxxxx`ccccc... where
 --x's give pointer into libdb, c's are comments
   firstPart := dbPart(line,1,-1)
-  key := INTERN SUBSTRING(firstPart,0,1)    --extract this and throw away
-  address := SUBSTRING(firstPart, 1, nil)   --address in libdb
+  key := INTERN subString(firstPart,0,1)    --extract this and throw away
+  address := subString(firstPart, 1)        --address in libdb
   instream := OPEN grepSource key           --this always returns libdb now
   FILE_-POSITION(instream,readInteger address)
   line := READLINE instream
@@ -988,7 +988,7 @@ dbUnpatchLines lines ==  --concatenate long lines together, skip blank lines
     #line = 0 => 'skip     --skip blank lines
     acc :=
       line.0 = dash and line.1 = dash =>
-        [strconc(first acc,SUBSTRING(line,2,nil)),:rest acc]
+        [strconc(first acc,subString(line,2)),:rest acc]
       [line,:acc]
   -- following call to nreverse needed to keep lines properly sorted
   nreverse acc  ------> added by BMT 12/95
diff --git a/src/interp/br-util.boot b/src/interp/br-util.boot
index 518ace12..a20f39c1 100644
--- a/src/interp/br-util.boot
+++ b/src/interp/br-util.boot
@@ -190,7 +190,7 @@ lisp2HT u == ['"_'",:fn u] where fn u ==
 args2HtString(x,:options) ==
   null x => '""
   emList := IFCAR options
-  SUBSTRING(form2HtString(['f,:x],emList),1,nil)
+  subString(form2HtString(['f,:x],emList),1)
 
 quickForm2HtString(x) ==
   atom x => STRINGIMAGE x
@@ -372,7 +372,7 @@ asharpConstructors() ==
 extractFileNameFromPath s == fn(s,0,#s) where
   fn(s,i,m) ==
     k := charPosition(char '_/,s,i)
-    k = m => SUBSTRING(s,i,nil)
+    k = m => subString(s,i)
     fn(s,k + 1,m)
 
 bcOpTable(u,fn) ==
@@ -609,12 +609,12 @@ dbKind line == line.0
 
 dbKindString kind == LASSOC(kind,$dbKindAlist)
 
-dbName line == escapeString SUBSTRING(line,1,charPosition($tick,line,1) - 1)
+dbName line == escapeString subString(line,1,charPosition($tick,line,1) - 1)
 
 dbAttr line == strconc(dbName line,escapeString dbPart(line,4,0))
 
 dbPart(line,n,k) ==  --returns part n of line (n=1,..) beginning in column k
-  n = 1 => SUBSTRING(line,k + 1,charPosition($tick,line,k + 1) - k - 1)
+  n = 1 => subString(line,k + 1,charPosition($tick,line,k + 1) - k - 1)
   dbPart(line,n - 1,charPosition($tick,line,k + 1))
 
 dbXParts(line,n,m) ==
@@ -623,7 +623,7 @@ dbXParts(line,n,m) ==
 
 dbParts(line,n,m) ==  --split line into n parts beginning in column m
   n = 0 => nil
-  [SUBSTRING(line,m,-m + (k := charPosition($tick,line,m))),
+  [subString(line,m,-m + (k := charPosition($tick,line,m))),
     :dbParts(line,n - 1,k + 1)]
 
 dbConname(line) == dbPart(line,5,1)
@@ -634,7 +634,7 @@ dbNewConname(line) == --dbName line unless kind is 'a or 'o => name in 5th pos.
   (kind := line.0) = char 'a or kind = char 'o =>
     conform := dbPart(line,5,1)
     k := charPosition(char '_(,conform,1)
-    SUBSTRING(conform,1,k - 1)
+    subString(conform,1,k - 1)
   dbName line
 
 dbTickIndex(line,n,k) == --returns index of nth tick in line starting at k
diff --git a/src/interp/c-doc.boot b/src/interp/c-doc.boot
index 6e5fb843..4e4460fc 100644
--- a/src/interp/c-doc.boot
+++ b/src/interp/c-doc.boot
@@ -375,7 +375,7 @@ checkRecordHash u ==
           HPUT($glossHash,htname,[first entry,:[[$name,:$origin],:rest entry]])
       else if x is '"\spadsys" and (u := checkLookForLeftBrace IFCDR u) and (u := IFCDR u) then
           s := checkGetStringBeforeRightBrace u
-          if s.0 = char '_) then s := SUBSTRING(s,1,nil)
+          if s.0 = char '_) then s := subString(s,1)
           parse := checkGetParse s
           null parse => checkDocError ['"Unparseable \spadtype: ",s]
           not member(opOf parse,$currentSysList) =>
@@ -409,8 +409,8 @@ checkGetParse s == ncParseFromString removeBackslashes s
 removeBackslashes s ==
     s = '"" => '""
     (k := charPosition($charBack,s,0)) < #s =>
-      k = 0 => removeBackslashes SUBSTRING(s,1,nil)
-      strconc(SUBSTRING(s,0,k),removeBackslashes SUBSTRING(s,k + 1,nil))
+      k = 0 => removeBackslashes subString(s,1)
+      strconc(subString(s,0,k),removeBackslashes subString(s,k + 1))
     s
 
 ++ returns the arity (as known to the global DB) of the functor
@@ -440,7 +440,7 @@ checkIsValidType form == main where
 checkGetLispFunctionName s ==
   n := #s
   (k := charPosition(char '_|,s,1)) and k < n and
-    (j := charPosition(char '_|,s,k + 1)) and j < n => SUBSTRING(s,k + 1,j-k-1)
+    (j := charPosition(char '_|,s,k + 1)) and j < n => subString(s,k + 1,j-k-1)
   checkDocError ['"Ill-formed lisp expression : ",s]
   'illformed
 
@@ -530,7 +530,7 @@ checkTrimCommented line ==
   k = 0 => '""
   --remarks beginning with %% are comments
   k >= n - 1 or line.(k + 1) ~= char '_% => line
-  k < #line => SUBSTRING(line,0,k)
+  k < #line => subString(line,0,k)
   line
 
 htcharPosition(char,line,i) ==
@@ -604,14 +604,14 @@ checkIndentedLines(u, margin) ==
     k = -1 =>
         verbatim => u2 := [:u2, $charFauxNewline]
         u2 := [:u2, '"\blankline "]
-    s := SUBSTRING(x, k, nil)
+    s := subString(x, k)
     s = '"\begin{verbatim}" =>
         verbatim := true
         u2 := [:u2, s]
     s = '"\end{verbatim}" =>
         verbatim := false
         u2 := [:u2, s]
-    verbatim => u2 := [:u2, SUBSTRING(x, margin, nil)]
+    verbatim => u2 := [:u2, subString(x, margin)]
     margin = k => u2 := [:u2, s]
     u2 := [:u2, strconc('"\indented{",STRINGIMAGE(k-margin),'"}{",checkAddSpaceSegments(s,0),'"}")]
   u2
@@ -650,16 +650,16 @@ checkGetArgs u ==
   NOT string? u => nil
   m := MAXINDEX u
   k := firstNonBlankPosition(u)
-  k > 0 => checkGetArgs SUBSTRING(u,k,nil)
+  k > 0 => checkGetArgs subString(u,k)
   stringPrefix?('"\spad{",u) =>
     k := getMatchingRightPren(u,6,char '_{,char '_}) or m
-    checkGetArgs SUBSTRING(u,6,k-6)
+    checkGetArgs subString(u,6,k-6)
   (i := charPosition(char '_(,u,0)) > m => nil
   (u . m) ~= char '_) => nil
   while (k := charPosition($charComma,u,i + 1)) < m repeat
-    acc := [trimString SUBSTRING(u,i + 1,k - i - 1),:acc]
+    acc := [trimString subString(u,i + 1,k - i - 1),:acc]
     i := k
-  nreverse [SUBSTRING(u,i + 1,m - i - 1),:acc]
+  nreverse [subString(u,i + 1,m - i - 1),:acc]
 
 checkGetMargin lines ==
   while lines repeat
@@ -682,7 +682,7 @@ checkAddIndented(x,margin) ==
   k := firstNonBlankPosition x
   k = -1 => '"\blankline "
   margin = k => x
-  strconc('"\indented{",STRINGIMAGE(k-margin),'"}{",checkAddSpaceSegments(SUBSTRING(x,k,nil),0),'"}")
+  strconc('"\indented{",STRINGIMAGE(k-margin),'"}{",checkAddSpaceSegments(subString(x,k),0),'"}")
 
 checkAddSpaceSegments(u,k) ==
   m := MAXINDEX u
@@ -691,8 +691,8 @@ checkAddSpaceSegments(u,k) ==
   j := i
   while (j := j + 1) < m and u.j = (char '_  ) repeat 'continue
   n := j - i   --number of blanks
-  n > 1 => strconc(SUBSTRING(u,0,i),'"\space{",
-             STRINGIMAGE n,'"}",checkAddSpaceSegments(SUBSTRING(u,i + n,nil),0))
+  n > 1 => strconc(subString(u,0,i),'"\space{",
+             STRINGIMAGE n,'"}",checkAddSpaceSegments(subString(u,i + n),0))
   checkAddSpaceSegments(u,j)
 
 checkTrim($x,lines) == main where
@@ -711,11 +711,11 @@ checkTrim($x,lines) == main where
     k
   trim(s) ==
     k := wherePP(s)
-    return SUBSTRING(s,k + 2,nil)
+    return subString(s,k + 2)
     m := MAXINDEX s
     n := k + 2
     for j in (k + 2)..m while s.j = $charBlank repeat (n := n + 1)
-    SUBSTRING(s,n,nil)
+    subString(s,n)
 
 checkExtract(header,lines) ==
   while lines repeat
@@ -729,7 +729,7 @@ checkExtract(header,lines) ==
   margin := k
   firstLines :=
     (k := firstNonBlankPosition(u,j + 1)) ~= -1 =>
-      [SUBSTRING(u,j + 1,nil),:rest lines]
+      [subString(u,j + 1),:rest lines]
     rest lines
   --now look for another header; if found skip all rest of these lines
   acc := nil
@@ -854,7 +854,7 @@ checkAddBackSlashes s ==
       char = $charBack => k := k + 2
       MEMQ(char,$charEscapeList) => return (insertIndex := k)
     k := k + 1
-  insertIndex => checkAddBackSlashes strconc(SUBSTRING(s,0,insertIndex),$charBack,s.k,SUBSTRING(s,insertIndex + 1,nil))
+  insertIndex => checkAddBackSlashes strconc(subString(s,0,insertIndex),$charBack,s.k,subString(s,insertIndex + 1))
   s
 
 checkAddSpaces u ==
@@ -905,9 +905,9 @@ checkIeEgfun x ==
     x.(k + 1) = $charPeriod and x.(k + 3) = $charPeriod and
      (x.k = char 'i and x.(k + 2) = char 'e and (key := '"that is")
        or x.k = char 'e and x.(k + 2) = char 'g and (key := '"for example")) =>
-          firstPart := (k > 0 => [SUBSTRING(x,0,k)]; nil)
-          result := [:firstPart,'"\spadignore{",SUBSTRING(x,k,4),'"}",
-                     :checkIeEgfun SUBSTRING(x,k+4,nil)]
+          firstPart := (k > 0 => [subString(x,0,k)]; nil)
+          result := [:firstPart,'"\spadignore{",subString(x,k,4),'"}",
+                     :checkIeEgfun subString(x,k+4)]
   result
 
 checkSplit2Words u ==
@@ -945,14 +945,14 @@ checkSplitBackslash x ==
   (k := charPosition($charBack,x,0)) < m =>
     m = 1 or alphabetic?(x . (k + 1)) =>        --starts with a backslash so..
       (k := charPosition($charBack,x,1)) < m => --..see if there is another
-         [SUBSTRING(x,0,k),:checkSplitBackslash SUBSTRING(x,k,nil)]  -- yup
+         [subString(x,0,k),:checkSplitBackslash subString(x,k)]  -- yup
       [x]                                       --no, just return line
     k = 0 => --starts with backspace but x.1 is not a letter; break it up
-      [SUBSTRING(x,0,2),:checkSplitBackslash SUBSTRING(x,2,nil)]
-    u := SUBSTRING(x,0,k)
-    v := SUBSTRING(x,k,2)
+      [subString(x,0,2),:checkSplitBackslash subString(x,2)]
+    u := subString(x,0,k)
+    v := subString(x,k,2)
     k + 1 = m => [u,v]
-    [u,v,:checkSplitBackslash SUBSTRING(x,k + 2,nil)]
+    [u,v,:checkSplitBackslash subString(x,k + 2)]
   [x]
 
 checkSplitPunctuation x ==
@@ -963,22 +963,22 @@ checkSplitPunctuation x ==
   lastchar = $charPeriod and x.(m - 1) = $charPeriod =>
     m = 1 => [x]
     m > 3 and x.(m-2) = $charPeriod =>
-      [:checkSplitPunctuation SUBSTRING(x,0,m-2),'"..."]
-    [:checkSplitPunctuation SUBSTRING(x,0,m-1),'".."]
+      [:checkSplitPunctuation subString(x,0,m-2),'"..."]
+    [:checkSplitPunctuation subString(x,0,m-1),'".."]
   lastchar = $charPeriod or lastchar = $charSemiColon or lastchar = $charComma
-    => [SUBSTRING(x,0,m),lastchar]
-  m > 1 and x.(m - 1) = $charQuote => [SUBSTRING(x,0,m - 1),SUBSTRING(x,m-1,nil)]
+    => [subString(x,0,m),lastchar]
+  m > 1 and x.(m - 1) = $charQuote => [subString(x,0,m - 1),subString(x,m-1)]
   (k := charPosition($charBack,x,0)) < m =>
     k = 0 =>
       m = 1 or HGET($htMacroTable,x) or alphabetic? x.1 => [x]
-      v := SUBSTRING(x,2,nil)
-      [SUBSTRING(x,0,2),:checkSplitPunctuation v]
-    u := SUBSTRING(x,0,k)
-    v := SUBSTRING(x,k,nil)
+      v := subString(x,2)
+      [subString(x,0,2),:checkSplitPunctuation v]
+    u := subString(x,0,k)
+    v := subString(x,k)
     [:checkSplitPunctuation u,:checkSplitPunctuation v]
   (k := charPosition($charDash,x,1)) < m =>
-    u := SUBSTRING(x,k + 1,nil)
-    [SUBSTRING(x,0,k),$charDash,:checkSplitPunctuation u]
+    u := subString(x,k + 1)
+    [subString(x,0,k),$charDash,:checkSplitPunctuation u]
   [x]
 
 checkSplitOn(x) ==
@@ -995,9 +995,9 @@ checkSplitOn(x) ==
     l := rest l
   null l => [x]
   k = -1 => [char]
-  k = 0 => [char,SUBSTRING(x,1,nil)]
-  k = MAXINDEX x => [SUBSTRING(x,0,k),char]
-  [SUBSTRING(x,0,k),char,:checkSplitOn SUBSTRING(x,k + 1,nil)]
+  k = 0 => [char,subString(x,1)]
+  k = MAXINDEX x => [subString(x,0,k),char]
+  [subString(x,0,k),char,:checkSplitOn subString(x,k + 1)]
 
 
 checkBalance u ==
@@ -1133,7 +1133,7 @@ checkTransformFirsts(opname,u,margin) ==
     open = char '_[ and (close := char '_]) or
           open = char '_(  and (close := char '_)) =>
       k := getMatchingRightPren(u,j + 1,open,close)
-      namestring ~= (firstWord := SUBSTRING(u,0,i)) =>
+      namestring ~= (firstWord := subString(u,0,i)) =>
         checkDocError ['"Improper first word in comments: ",firstWord]
         u
       null k =>
@@ -1141,43 +1141,43 @@ checkTransformFirsts(opname,u,margin) ==
            then checkDocError ['"Missing close bracket on first line: ", u]
            else checkDocError ['"Missing close parenthesis on first line: ", u]
          u
-      strconc('"\spad{",SUBSTRING(u,0,k + 1),'"}",SUBSTRING(u,k + 1,nil))
+      strconc('"\spad{",subString(u,0,k + 1),'"}",subString(u,k + 1))
     k := checkSkipToken(u,j,m) or return u
-    infixOp := INTERN SUBSTRING(u,j,k - j)
+    infixOp := INTERN subString(u,j,k - j)
     not GETL(infixOp,'Led) =>                                     --case 3
-      namestring ~= (firstWord := SUBSTRING(u,0,i)) =>
+      namestring ~= (firstWord := subString(u,0,i)) =>
         checkDocError ['"Improper first word in comments: ",firstWord]
         u
       #(p := PNAME infixOp) = 1 and (open := p.0) and
         (close := LASSOC(open,$checkPrenAlist)) =>  --have an open bracket
           l := getMatchingRightPren(u,k + 1,open,close)
           if l > MAXINDEX u then l := k - 1
-          strconc('"\spad{",SUBSTRING(u,0,l + 1),'"}",SUBSTRING(u,l + 1,nil))
-      strconc('"\spad{",SUBSTRING(u,0,k),'"}",SUBSTRING(u,k,nil))
+          strconc('"\spad{",subString(u,0,l + 1),'"}",subString(u,l + 1))
+      strconc('"\spad{",subString(u,0,k),'"}",subString(u,k))
     l := checkSkipBlanks(u,k,m) or return u
     n := checkSkipToken(u,l,m) or return u
     namestring ~= PNAME infixOp =>
       checkDocError ['"Improper initial operator in comments: ",infixOp]
       u
-    strconc('"\spad{",SUBSTRING(u,0,n),'"}",SUBSTRING(u,n,nil))   --case 5
+    strconc('"\spad{",subString(u,0,n),'"}",subString(u,n))   --case 5
   true =>          -- not alphabetic? u.0 =>
     i := checkSkipToken(u,0,m) or return u
-    namestring ~= (firstWord := SUBSTRING(u,0,i)) =>
+    namestring ~= (firstWord := subString(u,0,i)) =>
       checkDocError ['"Improper first word in comments: ",firstWord]
       u
-    prefixOp := INTERN SUBSTRING(u,0,i)
+    prefixOp := INTERN subString(u,0,i)
     not GETL(prefixOp,'Nud) =>
       u ---what could this be?
     j := checkSkipBlanks(u,i,m) or return u
     u.j = char '_( =>                                            --case 4
       j := getMatchingRightPren(u,j + 1,char '_(,char '_))
       j > m => u
-      strconc('"\spad{",SUBSTRING(u,0,j + 1),'"}",SUBSTRING(u,j + 1,nil))
+      strconc('"\spad{",subString(u,0,j + 1),'"}",subString(u,j + 1))
     k := checkSkipToken(u,j,m) or return u
-    namestring ~= (firstWord := SUBSTRING(u,0,i)) =>
+    namestring ~= (firstWord := subString(u,0,i)) =>
       checkDocError ['"Improper first word in comments: ",firstWord]
       u
-    strconc('"\spad{",SUBSTRING(u,0,k),'"}",SUBSTRING(u,k,nil))
+    strconc('"\spad{",subString(u,0,k),'"}",subString(u,k))
 
 getMatchingRightPren(u,j,open,close) ==
   count := 0
diff --git a/src/interp/database.boot b/src/interp/database.boot
index 43ca1697..d7e98938 100644
--- a/src/interp/database.boot
+++ b/src/interp/database.boot
@@ -692,7 +692,7 @@ getOplistWithUniqueSignatures(op,pairlis,signatureAlist) ==
 --% Exposure Group Code
 
 dropPrefix(fn) ==
-  member(fn.0,[char "?",char "-",char "+"]) => SUBSTRING(fn,1,nil)
+  member(fn.0,[char "?",char "-",char "+"]) => subString(fn,1)
   fn
 
 --moved to util.lisp
@@ -717,8 +717,8 @@ dropPrefix(fn) ==
 --++       p := STRPOS('" ",x,1,NIL)
 --++       null p =>
 --++     throwKeyedMsg("S2IZ0069B",[namestring egFile,x])
---++       n := object2Identifier SUBSTRING(x,0,p)
---++       x := dropLeadingBlanks SUBSTRING(x,p+1,NIL)
+--++       n := object2Identifier subString(x,0,p)
+--++       x := dropLeadingBlanks subString(x,p+1)
 --++       # x = 0 =>
 --++     throwKeyedMsg("S2IZ0069B",[namestring egFile,x])
 --++       egFiles := [[n,:object2Identifier x],:egFiles]
diff --git a/src/interp/format.boot b/src/interp/format.boot
index 3f496411..c780041c 100644
--- a/src/interp/format.boot
+++ b/src/interp/format.boot
@@ -629,7 +629,7 @@ isInternalFunctionName(op) ==
   table := MAKETRTTABLE('"0123456789",NIL)
   s := STRPOSL(table,op',1,true)
   null(s) or s > e => NIL
-  SUBSTRING(op',s,e-s)
+  subString(op',s,e-s)
 
 application2String(op,argl, linkInfo) ==
   null argl =>
diff --git a/src/interp/functor.boot b/src/interp/functor.boot
index c8ab1c8a..77dee1b1 100644
--- a/src/interp/functor.boot
+++ b/src/interp/functor.boot
@@ -890,10 +890,10 @@ splitEncodedFunctionName(encodedName, sep) ==
     null (p2 := STRPOS(sep0, encodedName, p1+1, '"*")) => 'inner
 --  This is picked up in compile for inner functions in partial compilation
     null (p3 := STRPOS(sep,  encodedName, p2+1, '"*")) => nil
-    s1 := SUBSTRING(encodedName, 0,    p1)
-    s2 := SUBSTRING(encodedName, p1+1, p2-p1-1)
-    s3 := SUBSTRING(encodedName, p2+1, p3-p2-1)
-    s4 := SUBSTRING(encodedName, p3+1, nil)
+    s1 := subString(encodedName, 0,    p1)
+    s2 := subString(encodedName, p1+1, p2-p1-1)
+    s3 := subString(encodedName, p2+1, p3-p2-1)
+    s4 := subString(encodedName, p3+1)
     [s1, s2, s3, s4]
  
 mkRepititionAssoc l ==
diff --git a/src/interp/g-util.boot b/src/interp/g-util.boot
index 93aac9dc..9737c712 100644
--- a/src/interp/g-util.boot
+++ b/src/interp/g-util.boot
@@ -1005,7 +1005,7 @@ dropLeadingBlanks str ==
     if SCHAR(str,i) ~= char " " then nb := i
     else i := i + 1
   nb = 0 => str
-  nb => SUBSTRING(str,nb,NIL)
+  nb => subString(str,nb)
   '""
 
 concat(:l) == concatList l
@@ -1273,7 +1273,7 @@ leftTrim s ==
   k < 0 => s
   s.0 = $blank =>
     for i in 0..k while s.i = $blank repeat (j := i)
-    SUBSTRING(s,j + 1,nil)
+    subString(s,j + 1)
   s
 
 rightTrim s ==  -- assumed a non-empty string
@@ -1281,7 +1281,7 @@ rightTrim s ==  -- assumed a non-empty string
   k < 0 => s
   s.k = $blank =>
     for i in k..0 by -1 while s.i = $blank repeat (j := i)
-    SUBSTRING(s,0,j)
+    subString(s,0,j)
   s
 
 pp x ==
diff --git a/src/interp/guess.boot b/src/interp/guess.boot
index b7d2e000..16eaef47 100644
--- a/src/interp/guess.boot
+++ b/src/interp/guess.boot
@@ -73,12 +73,12 @@ wordsOfString1(s,j) ==
     tailWords:=
       upperCase? s.(k+1) =>
         n:= or/[i for i in (k+2)..(MAXINDEX(s)-1)|not upperCase? s.i]
-        null n => [SUBSTRING(s,k,nil)]
-        n > k+1 => [SUBSTRING(s,k,n-k-1),:wordsOfString1(s,n-1)]
+        null n => [subString(s,k)]
+        n > k+1 => [subString(s,k,n-k-1),:wordsOfString1(s,n-1)]
       m := or/[i for i in (k+2)..(MAXINDEX(s)-1) | upperCase? s.i] =>
-        [SUBSTRING(s,k,m-k),:wordsOfString1(s,m)]
-      [SUBSTRING(s,k,nil)]
-    k > j+1 => [SUBSTRING(s,j,k-j),:tailWords]
+        [subString(s,k,m-k),:wordsOfString1(s,m)]
+      [subString(s,k)]
+    k > j+1 => [subString(s,j,k-j),:tailWords]
     tailWords
   nil
 
diff --git a/src/interp/ht-root.boot b/src/interp/ht-root.boot
index 595bf4c9..928f6f4a 100644
--- a/src/interp/ht-root.boot
+++ b/src/interp/ht-root.boot
@@ -146,7 +146,7 @@ htGlossPage(htPage,pattern,tryAgain?) ==
   null lines =>
     tryAgain? and #pattern > 0 =>
       (pattern.(k := MAXINDEX(pattern))) = char 's =>
-        htGlossPage(htPage,SUBSTRING(pattern,0,k),true)
+        htGlossPage(htPage,subString(pattern,0,k),true)
       upperCase? pattern.0 =>
         htGlossPage(htPage,DOWNCASE pattern,false)
       errorPage(htPage,['"Sorry",nil,['"\centerline{",:heading,'"}"]])
@@ -155,7 +155,7 @@ htGlossPage(htPage,pattern,tryAgain?) ==
   htSay('"\beginscroll\beginmenu")
   for line in lines repeat
     tick := charPosition($tick,line,1)
-    htSay('"\item{\em \menuitemstyle{}}\tab{0}{\em ",escapeString SUBSTRING(line,0,tick),'"} ",SUBSTRING(line,tick + 1,nil))
+    htSay('"\item{\em \menuitemstyle{}}\tab{0}{\em ",escapeString subString(line,0,tick),'"} ",subString(line,tick + 1))
   htSay '"\endmenu "
   htSay '"\endscroll\newline "
   htMakePage [['bcLinks,['"Search",'"",'htGlossSearch,nil]]]
@@ -168,18 +168,18 @@ gatherGlossLines(results,defstream) ==
   for keyline in results repeat
     --keyline := READLINE instream
     n := charPosition($tick,keyline,0)
-    keyAndTick := SUBSTRING(keyline,0,n + 1)
-    byteAddress := string2Integer SUBSTRING(keyline,n + 1,nil)
+    keyAndTick := subString(keyline,0,n + 1)
+    byteAddress := string2Integer subString(keyline,n + 1)
     FILE_-POSITION(defstream,byteAddress)
     line := READLINE defstream
     k := charPosition($tick,line,1)
-    pointer := SUBSTRING(line,0,k)
-    def := SUBSTRING(line,k + 1,nil)
+    pointer := subString(line,0,k)
+    def := subString(line,k + 1)
     xtralines := nil
     while not EOFP defstream and (x := READLINE defstream) and
-      (j := charPosition($tick,x,1)) and (nextPointer := SUBSTRING(x,0,j))
+      (j := charPosition($tick,x,1)) and (nextPointer := subString(x,0,j))
         and (nextPointer = pointer) repeat
-          xtralines := [SUBSTRING(x,j + 1,nil),:xtralines]
+          xtralines := [subString(x,j + 1),:xtralines]
     acc := [strconc(keyAndTick,def, strconc/nreverse xtralines),:acc]
   reverse acc
 
@@ -271,11 +271,11 @@ mkUnixPattern s ==
   u := mkUpDownPattern s
   starPositions := reverse [i for i in 1..(-1 + MAXINDEX u) | u.i = $wild]
   for i in starPositions repeat
-    u := strconc(SUBSTRING(u,0,i),'".*",SUBSTRING(u,i + 1,nil))
+    u := strconc(subString(u,0,i),'".*",subString(u,i + 1))
   if u.0 ~= $wild then u := strconc('"[^a-zA-Z]",u)
-                  else u := SUBSTRING(u,1,nil)
+                  else u := subString(u,1)
   if u.(k := MAXINDEX u) ~= $wild then u := strconc(u,'"[^a-zA-Z]")
-                                  else u := SUBSTRING(u,0,k)
+                                  else u := subString(u,0,k)
   u
 
 
diff --git a/src/interp/ht-util.boot b/src/interp/ht-util.boot
index f7b3b6b9..ccb4c3f3 100644
--- a/src/interp/ht-util.boot
+++ b/src/interp/ht-util.boot
@@ -137,8 +137,8 @@ htpLabelFilteredInputString(htPage, label) ==
 replacePercentByDollar s == fn(s,0,MAXINDEX s) where
   fn(s,i,n) ==
     i > n => '""
-    (m := charPosition(char "%",s,i)) > n => SUBSTRING(s,i,nil)
-    strconc(SUBSTRING(s,i,m - i),'"$",fn(s,m + 1,n))
+    (m := charPosition(char "%",s,i)) > n => subString(s,i)
+    strconc(subString(s,i,m - i),'"$",fn(s,m + 1,n))
 
 htpSetLabelInputString(htPage, label, val) ==
 -- value user typed as input string on page
@@ -403,7 +403,7 @@ templateParts template ==
   null string? template => template
   i := SEARCH('"%l", template)
   null i => template
-  [SUBSEQ(template, 0, i), : SUBSEQ(template, i+2)]
+  [subSequence(template, 0, i), : subSequence(template, i+2)]
 
 htMakeDoneButton(message, func) ==
   bcHt '"\newline\vspace{1}\centerline{"
diff --git a/src/interp/htcheck.boot b/src/interp/htcheck.boot
index 48f8f07f..088fc2b2 100644
--- a/src/interp/htcheck.boot
+++ b/src/interp/htcheck.boot
@@ -100,13 +100,13 @@ buildHtMacroTable() ==
 getHtMacroItem line ==
   not stringPrefix?('"\newcommand{",line) => nil
   k := charPosition(char '_},line,11)
-  command := SUBSTRING(line,12,k - 12)
+  command := subString(line,12,k - 12)
   numOfArgs :=
     m := #line
     i := charPosition(char '_[,line,k)
     i = m => 0
     j := charPosition(char '_],line,i + 1)
-    digitString := SUBSTRING(line,i + 1,j - i - 1)
+    digitString := subString(line,i + 1,j - i - 1)
     and/[digit? digitString.i for i in 0..MAXINDEX digitString]
       => readInteger digitString
     return nil
diff --git a/src/interp/i-output.boot b/src/interp/i-output.boot
index f064be78..d4ddf4df 100644
--- a/src/interp/i-output.boot
+++ b/src/interp/i-output.boot
@@ -1601,12 +1601,12 @@ outputNumber(start,linelength,num) ==
      linelength:=linelength-1 
   while # num > linelength repeat
     if $collectOutput then
-       $outputLines := [strconc(blnks, SUBSTRING(num,0,linelength),under),
+       $outputLines := [strconc(blnks, subString(num,0,linelength),under),
                         :$outputLines]
     else
       sayALGEBRA [blnks,
-                  SUBSTRING(num,0,linelength),under]
-    num := SUBSTRING(num,linelength,NIL)
+                  subString(num,0,linelength),under]
+    num := subString(num,linelength)
     if firsttime then 
          blnks:=strconc(blnks,'" ")
          linelength:=linelength-1
@@ -1621,11 +1621,11 @@ outputString(start,linelength,str) ==
   else blnks := '""
   while # str > linelength repeat
     if $collectOutput then
-       $outputLines := [strconc(blnks, SUBSTRING(str,0,linelength)),
+       $outputLines := [strconc(blnks, subString(str,0,linelength)),
                         :$outputLines]
     else
-      sayALGEBRA [blnks, SUBSTRING(str,0,linelength)]
-    str := SUBSTRING(str,linelength,NIL)
+      sayALGEBRA [blnks, subString(str,0,linelength)]
+    str := subString(str,linelength)
   if $collectOutput then
     $outputLines := [strconc(blnks, str), :$outputLines]
   else
diff --git a/src/interp/i-syscmd.boot b/src/interp/i-syscmd.boot
index 60af6ca7..3618d556 100644
--- a/src/interp/i-syscmd.boot
+++ b/src/interp/i-syscmd.boot
@@ -142,7 +142,7 @@ unAbbreviateKeyword x ==
   x' :=selectOptionLC(x,$SYSCOMMANDS,'commandErrorIfAmbiguous)
   if not x' then
     x' := 'system
-    SETQ(LINE, strconc('")system ", SUBSTRING(LINE, 1, #LINE-1)))
+    SETQ(LINE, strconc('")system ", subString(LINE, 1, #LINE-1)))
     $currentLine := LINE
   selectOption(x',commandsForUserLevel $systemCommands,
     'commandUserLevelError)
@@ -204,11 +204,11 @@ commandAmbiguityError(kind,x,u) ==
 
 getSystemCommandLine() ==
   p := STRPOS('")",$currentLine,0,NIL)
-  line := if p then SUBSTRING($currentLine,p,NIL) else $currentLine
+  line := if p then subString($currentLine,p) else $currentLine
   maxIndex:= MAXINDEX line
   for i in 0..maxIndex while (line.i ~= " ") repeat index:= i
   if index=maxIndex then line := '""
-  else line := SUBSTRING(line,index+2,nil)
+  else line := subString(line,index+2)
   line
 
 ------------ start of commands ------------------------------------------
@@ -562,9 +562,9 @@ compileAsharpCmd1 args ==
         pathType = '"ao" =>
             -- want to strip out -Fao
             (p := STRPOS('"-Fao", $asharpCmdlineFlags, 0, NIL)) =>
-                p = 0 => SUBSTRING($asharpCmdlineFlags, 5, NIL)
-                strconc(SUBSTRING($asharpCmdlineFlags, 0, p), '" ",
-                    SUBSTRING($asharpCmdlineFlags, p+5, NIL))
+                p = 0 => subString($asharpCmdlineFlags, 5)
+                strconc(subString($asharpCmdlineFlags, 0, p), '" ",
+                    subString($asharpCmdlineFlags, p+5))
             $asharpCmdlineFlags
         $asharpCmdlineFlags
 
@@ -1687,10 +1687,10 @@ writeInputLines(fn,initial) ==
         for j in 1..maxn while not done repeat
           k := 1 + maxn - j
           MEMQ(vec.k,breakChars) =>
-            svec := strconc(SUBSTRING(vec,0,k+1),UNDERBAR)
+            svec := strconc(subString(vec,0,k+1),UNDERBAR)
             lineList := [svec,:lineList]
             done := true
-            vec := SUBSTRING(vec,k+1,NIL)
+            vec := subString(vec,k+1)
             n := # vec
         -- in case we can't find a breaking point
         if not done then n := 0
@@ -2617,7 +2617,7 @@ processSynonymLine line ==
       for i in 0..mx repeat
         line.i = " " =>
           return (for j in (i+1)..mx repeat
-            line.j ~= " " => return (SUBSTRING (line, j, nil)))
+            line.j ~= " " => return (subString(line, j)))
   [key, :value]
 
 
@@ -2800,13 +2800,13 @@ removeUndoLines u == --called by writeInputLines
   for y in tails u repeat
     (x := first y).0 = char '_) =>
       stringPrefix?('")undo",s := trimString x) => --parse "undo )option"
-        s1 := trimString SUBSTRING(s,5,nil)
+        s1 := trimString subString(s,5)
         if s1 ~= '")redo" then
           m := charPosition(char '_),s1,0)
           code :=
             m < MAXINDEX s1 => s1.(m + 1)
             char 'a
-          s2 := trimString SUBSTRING(s1,0,m)
+          s2 := trimString subString(s1,0,m)
         n :=
            s1 = '")redo" => 0
            s2 ~= '"" => undoCount readInteger s2
@@ -2818,7 +2818,7 @@ removeUndoLines u == --called by writeInputLines
   for y in tails nreverse u repeat
     (x := first y).0 = char '_> =>
       code := x . 1                                 --code = a,b, or r
-      n := readInteger SUBSTRING(x,2,nil)           --n = number of undo steps
+      n := readInteger subString(x,2)               --n = number of undo steps
       y := rest y                                   --kill >n line
       while y repeat
         c := first y
@@ -2917,7 +2917,7 @@ printLabelledList(ls,label1,label2,prefix,patterns) ==
     sayMessage [label1,'"-defined ",label2,'" satisfying patterns:",
      '"%l",'"   ",'"%b",:blankList patterns,'"%d"]
   for [syn,:comm] in ls repeat
-    if SUBSTRING(syn,0,1) = '"|" then syn := SUBSTRING(syn,1,NIL)
+    if subString(syn,0,1) = '"|" then syn := subString(syn,1,NIL)
     if syn = '"%i" then syn := '"%i "
     wid := MAX(30 - (entryWidth syn),1)
     sayBrightly concat('"%b",prefix,syn,'"%d",
@@ -3061,21 +3061,21 @@ processSynonyms() ==
   fill := '""
   if p
     then
-      line := SUBSTRING(LINE,p,NIL)
-      if p > 0 then fill := SUBSTRING(LINE,0,p)
+      line := subString(LINE,p)
+      if p > 0 then fill := subString(LINE,0,p)
     else
       p := 0
       line := LINE
   to := STRPOS ('" ", line, 1, nil)
   if to then to := to - 1
-  synstr := SUBSTRING (line, 1, to)
+  synstr := subString(line, 1, to)
   syn := STRING2ID_-N (synstr, 1)
   null (fun := LASSOC (syn, $CommandSynonymAlist)) => NIL
   fun := eval fun              -- fun may have been a suspension
   to := STRPOS('")",fun,1,NIL)
   if to and to ~= #(fun)-1 then
-    opt := strconc('" ",SUBSTRING(fun,to,NIL))
-    fun := SUBSTRING(fun,0,to-1)
+    opt := strconc('" ",subString(fun,to))
+    fun := subString(fun,0,to-1)
   else opt := '" "
   if # synstr > # fun then
     for i in (# fun)..(# synstr) repeat
@@ -3093,8 +3093,8 @@ tabsToBlanks s ==
    k := charPosition($charTab,s,0)
    n := #s
    k < n =>
-      k = 0 => tabsToBlanks SUBSTRING(s,1,nil)
-      strconc(SUBSTRING(s,0,k),$charBlank, tabsToBlanks SUBSTRING(s,k + 1,nil))
+      k = 0 => tabsToBlanks subString(s,1)
+      strconc(subString(s,0,k),$charBlank, tabsToBlanks subString(s,k + 1))
    s
 
 doSystemCommand string ==
@@ -3102,7 +3102,7 @@ doSystemCommand string ==
    LINE: fluid := string
    processSynonyms()
    string := LINE
-   string:=SUBSTRING(string,1,nil)
+   string:=subString(string,1)
    string = '"" => nil
    tok:=getFirstWord(string)
    tok =>
@@ -3128,14 +3128,14 @@ handleNoParseCommands(unab, string) ==
     if (null spaceIndex) then
       sayKeyedMsg("S2IV0005", NIL)
       nil
-    else npboot(SUBSEQ(string, spaceIndex+1))
+    else npboot(subSequence(string, spaceIndex+1))
   unab = "system" =>
     if (null spaceIndex) then
       sayKeyedMsg("S2IV0005", NIL)
       nil
     else npsystem(unab, string)
   unab = "synonym" =>
-    npsynonym(unab, (null spaceIndex => '""; SUBSEQ(string, spaceIndex+1)))
+    npsynonym(unab, (null spaceIndex => '""; subSequence(string, spaceIndex+1)))
   null spaceIndex =>
     FUNCALL unab
   unab in '( quit     _
@@ -3146,7 +3146,7 @@ handleNoParseCommands(unab, string) ==
     sayKeyedMsg("S2IV0005", NIL)
     nil
   funName := INTERN strconc('"np",STRING unab)
-  FUNCALL(funName, SUBSEQ(string, spaceIndex+1))
+  FUNCALL(funName, subSequence(string, spaceIndex+1))
 
 
 npboot str ==
@@ -3163,7 +3163,7 @@ stripLisp str ==
     (char str.c0) ~= (char lispStr.c1) =>
       return nil
     strIndex := c0+1
-  SUBSEQ(str, strIndex)
+  subSequence(str, strIndex)
 
 
 nplisp str ==
@@ -3174,12 +3174,12 @@ npsystem(unab, str) ==
   spaceIndex := SEARCH('" ", str)
   null spaceIndex =>
     sayKeyedMsg('"S2IZ0080", [str])
-  sysPart := SUBSEQ(str, 0, spaceIndex)
+  sysPart := subSequence(str, 0, spaceIndex)
   -- The following is a hack required by the fact that unAbbreviateKeyword
   -- returns the word "system" for unknown words
   null SEARCH(sysPart, STRING unab) =>
     sayKeyedMsg('"S2IZ0080", [sysPart])
-  command := SUBSEQ(str, spaceIndex+1)
+  command := subSequence(str, spaceIndex+1)
   runCommand command
 
 npsynonym(unab, str) ==
@@ -3193,7 +3193,7 @@ tokTran tok ==
     #tok = 0 => nil
     isIntegerString tok => READ_-FROM_-STRING tok
     STRING tok.0 = '"_"" =>
-      SUBSEQ(tok, 1, #tok-1)
+      subSequence(tok, 1, #tok-1)
     INTERN tok
   tok
 
@@ -3216,11 +3216,11 @@ splitIntoOptionBlocks str ==
     if STRING str.i = '")" and not inString
     then parenCount := parenCount - 1
     STRING str.i = '")" and not inString and parenCount = -1 =>
-      block := stripSpaces SUBSEQ(str, blockStart, i)
+      block := stripSpaces subSequence(str, blockStart, i)
       blockList := [block, :blockList]
       blockStart := i+1
       parenCount := 0
-  blockList := [stripSpaces SUBSEQ(str, blockStart), :blockList]
+  blockList := [stripSpaces subSequence(str, blockStart), :blockList]
   nreverse blockList
 
 dumbTokenize str ==
@@ -3235,12 +3235,12 @@ dumbTokenize str ==
       previousSpace := false
     STRING str.i = '" " and not inString =>
       previousSpace => nil
-      token := stripSpaces SUBSEQ(str, tokenStart, i)
+      token := stripSpaces subSequence(str, tokenStart, i)
       tokenList := [token, :tokenList]
       tokenStart := i+1
       previousSpace := true
     previousSpace := false
-  tokenList := [stripSpaces SUBSEQ(str, tokenStart), :tokenList]
+  tokenList := [stripSpaces subSequence(str, tokenStart), :tokenList]
   nreverse tokenList
 
 handleParsedSystemCommands(unabr, optionList) ==
@@ -3252,8 +3252,8 @@ handleParsedSystemCommands(unabr, optionList) ==
 parseSystemCmd opt ==
   spaceIndex := SEARCH('" ", opt)
   spaceIndex =>
-    commandString := stripSpaces SUBSEQ(opt, 0, spaceIndex)
-    argString := stripSpaces SUBSEQ(opt, spaceIndex)
+    commandString := stripSpaces subSequence(opt, 0, spaceIndex)
+    argString := stripSpaces subSequence(opt, spaceIndex)
     command := tokTran commandString
     pform := parseFromString argString
     [command, pform]
@@ -3273,7 +3273,7 @@ handleTokensizeSystemCommands(unabr, optionList) ==
 getFirstWord string ==
   spaceIndex := SEARCH('" ", string)
   null spaceIndex => string
-  stripSpaces SUBSEQ(string, 0, spaceIndex)
+  stripSpaces subSequence(string, 0, spaceIndex)
 
 ltrace l == trace l
 
diff --git a/src/interp/i-util.boot b/src/interp/i-util.boot
index 1d423706..6563be32 100644
--- a/src/interp/i-util.boot
+++ b/src/interp/i-util.boot
@@ -73,7 +73,7 @@ MKPROMPT() ==
     strconc(STRINGIMAGE $interpreterFrameName,
       '" (",STRINGIMAGE $IOindex,'") -> ")
   strconc(STRINGIMAGE $interpreterFrameName,
-   '" [", SUBSTRING(CURRENTTIME(),8,NIL),'"] [",
+   '" [", subString(CURRENTTIME(),8),'"] [",
     STRINGIMAGE $IOindex, '"] -> ")
  
 
diff --git a/src/interp/incl.boot b/src/interp/incl.boot
index fbfdec71..c5d84db6 100644
--- a/src/interp/incl.boot
+++ b/src/interp/incl.boot
@@ -136,7 +136,7 @@ incCommandTail(s, info) ==
  
 incDrop(n, b) ==
             n >= #b => ""
-            SUBSTRING(b,n,nil)
+            subString(b,n)
  
  
 inclFname(s, info) == incFileName incCommandTail(s, info)
@@ -148,12 +148,12 @@ incBiteOff x ==
           else
              n1:=STRPOSL ('" ",x,n,nil)
              if null n1 -- all nonspaces
-             then [SUBSTRING(x,n,nil),'""]
-             else [SUBSTRING(x,n,n1-n),SUBSTRING(x,n1,nil)]
+             then [subString(x,n),'""]
+             else [subString(x,n,n1-n),subString(x,n1)]
  
 incTrunc (n,x)==
      if #x>n
-     then SUBSTRING(x,0,n)
+     then subString(x,0,n)
      else x
  
 incFileName x == first incBiteOff x
diff --git a/src/interp/int-top.boot b/src/interp/int-top.boot
index f4c0240b..e7db6a29 100644
--- a/src/interp/int-top.boot
+++ b/src/interp/int-top.boot
@@ -162,7 +162,7 @@ intloopReadConsole(b, n)==
              not $leanMode and printPrompt()
              intloopReadConsole('"", c)
     a:=strconc(b,a)
-    ncloopEscaped a => intloopReadConsole(SUBSEQ(a, 0, (# a) - 1),n)
+    ncloopEscaped a => intloopReadConsole(subSequence(a, 0, #a - 1),n)
     c := intloopProcessString(a, n)
     not $leanMode and printPrompt()
     intloopReadConsole('"", c)
@@ -182,7 +182,7 @@ intloopPrefix?(prefix,whole) ==
          spaces := spaces + 1
        else leading := false
      spaces = wlen => nil
-     if good then SUBSTRING(whole,spaces,nil) else good
+     if good then subString(whole,spaces) else good
  
  
 intloopProcess(n,interactive,s)==
@@ -418,7 +418,7 @@ ncloopPrefix?(prefix,whole) ==
      good:=true
      for i in 0..#prefix-1 for j in 0.. while good repeat
                 good:= prefix.i = whole.j
-     if good then SUBSTRING(whole,#prefix,nil) else good
+     if good then subString(whole,#prefix) else good
 
 $ncmPhase :=      NIL
  
diff --git a/src/interp/interop.boot b/src/interp/interop.boot
index e900dabe..97c27601 100644
--- a/src/interp/interop.boot
+++ b/src/interp/interop.boot
@@ -111,7 +111,7 @@ StringToCompStr(str) ==
    strconc(str, charString abstractChar 0)
 
 CompStrToString(str) == 
-   SUBSTRING(str, 0, (# str - 1))
+   subString(str, 0, #str - 1)
 -- local garbage ends
 
 runOldAxiomFunctor(:allArgs) ==
diff --git a/src/interp/intfile.boot b/src/interp/intfile.boot
index b362c134..bb09a699 100644
--- a/src/interp/intfile.boot
+++ b/src/interp/intfile.boot
@@ -46,7 +46,7 @@ shoeIntern (s)==
    f:=first s
    # f < 8 => shoeIntern rest s
    f.0=char " " =>shoeIntern rest s
-   a:=INTERN SUBSTRING (f,0,8)
+   a:=INTERN subString(f,0,8)
    [b,c]:= shoeStrings rest s
    SETF(GET (a,"MSGS"),b)
    shoeIntern c
diff --git a/src/interp/mark.boot b/src/interp/mark.boot
index ba127ef7..e1fa19b0 100644
--- a/src/interp/mark.boot
+++ b/src/interp/mark.boot
@@ -518,7 +518,7 @@ markOrigName x ==
       s := PNAME op
       k := charPosition(char '_;, s, 0)
       k > MAXINDEX s => nil
-      origName := INTERN SUBSTRING(s, k + 1, nil)
+      origName := INTERN subString(s, k + 1)
       property(op, 'ORIGNAME) := origName
       REMPROP(op,'PNAME)
     markOrigName op
@@ -1250,7 +1250,7 @@ changeToEqualEqual lines ==
     while (m := m + 1) <= N and alphabetic? (x . m) repeat nil
     m = n + 2 => nil
     not upperCase? (x . (n + 4)) => nil
-    word := INTERN SUBSTRING(x, n + 4, m - n - 4)
+    word := INTERN subString(x, n + 4, m - n - 4)
     expandedWord := macroExpand(word,$e)
     not (word in '(Record Union Mapping)
       or getConstructorFormFromDB opOf expandedWord) => nil
@@ -1275,10 +1275,10 @@ moveImportsAfterDefinitions lines ==
     m < 0 => nil
     ((n := charPosition($blank ,x,1 + m)) < N) and
       substring?('"== ", x, n+1) => 
-        name := SUBSTRING(x, m, n - m)
+        name := subString(x, m, n - m)
         defineAlist := [[name, :i], :defineAlist]
     (k := leadingSubstring?('"import from ",x, 0)) =>
-      importAlist := [[SUBSTRING(x,k + 12,nil), :i], :importAlist]
+      importAlist := [[subString(x,k + 12), :i], :importAlist]
 --  pp defineAlist
 --  pp importAlist
   for [name, :i] in defineAlist repeat
diff --git a/src/interp/match.boot b/src/interp/match.boot
index 2411f599..aee99c37 100644
--- a/src/interp/match.boot
+++ b/src/interp/match.boot
@@ -104,19 +104,19 @@ patternCheck pattern == main where
 --  pp c
     $oldWild  :local := $wildCard
     $wildCard := c
-    pattern := mknew(pattern,first u,rest u,SUBSTRING(pattern,0,first u))
+    pattern := mknew(pattern,first u,rest u,subString(pattern,0,first u))
 --  sayBrightlyNT ['"Replacing pattern by"]
 --  pp pattern
     pattern
   mknew(old,i,r,new) ==
     new := strconc(new,old.(i + 1))  --add underscored character to string
-    null r => strconc(new,subWild(SUBSTRING(old,i + 2,nil),0))
+    null r => strconc(new,subWild(subString(old,i + 2),0))
     mknew(old,first r,rest r,
-          strconc(new,subWild(SUBSTRING(old,i + 2,(first r) - i - 1),i + 1)))
+          strconc(new,subWild(subString(old,i + 2,(first r) - i - 1),i + 1)))
   subWild(s,i) ==
     (k := charPosition($oldWild,s,i)) < #s =>
-      strconc(SUBSTRING(s,i,k - i),$wildCard,subWild(s,k + 1))
-    SUBSTRING(s,i,nil)
+      strconc(subString(s,i,k - i),$wildCard,subWild(s,k + 1))
+    subString(s,i)
   pos(c,s) ==
     i := 0
     n := MAXINDEX s
@@ -152,14 +152,14 @@ basicMatch?(pattern,target) ==
   if p ~= 0 then
      -- pattern does not begin with a wild card
      ans := 0
-     s := SUBSTRING(pattern,0,p) --[pattern.i for i in 0..p-1]
+     s := subString(pattern,0,p) --[pattern.i for i in 0..p-1]
      not substring?(s,target,0) => return false
   else if n = 1 then return 0
   i := p   -- starting position for searching the target
   q := charPosition($wildCard,pattern,p+1)
   ltarget := #target
   while q ~= n repeat
-     s := SUBSTRING(pattern,p+1,q-p-1) --[pattern.i for i in (p+1..q-1)]
+     s := subString(pattern,p+1,q-p-1) --[pattern.i for i in (p+1..q-1)]
      i := stringPosition(s,target,i)
      if null ans then ans := stringPosition(s,target,p)
      -- for patterns beginning with wildcard, ans gives position of first match
@@ -170,7 +170,7 @@ basicMatch?(pattern,target) ==
   returnFlag => false
   if p ~= q-1 then
      -- pattern does not end with a wildcard
-     s := SUBSTRING(pattern,p+1,q-p-1) --[pattern.i for i in (p+1..q-1)]
+     s := subString(pattern,p+1,q-p-1) --[pattern.i for i in (p+1..q-1)]
      if not suffix?(s,target) then return false
      if null ans then ans := 1  --pattern is a word preceded by a *
   ans
@@ -187,19 +187,19 @@ matchAnySegment?(pattern,target,k,nc) ==  --k = start position; nc=#chars or NIL
     null nc => true
     m <= k + nc - n
   if k ~= 0 and nc then
-    target := SUBSTRING(target,k,nc)
+    target := subString(target,k,nc)
     k := 0
   if p ~= 0 then
      -- pattern does not begin with a wild card
      ans := 0
-     s := SUBSTRING(pattern,0,p) --[pattern.i for i in 0..p-1]
+     s := subString(pattern,0,p) --[pattern.i for i in 0..p-1]
      not substring?(s,target,k) => return false
   else if n = 1 then return true
   i := p + k  -- starting position for searching the target
   q := charPosition($wildCard,pattern,p+1)
   ltarget := #target
   while q ~= n repeat
-     s := SUBSTRING(pattern,p+1,q-p-1) --[pattern.i for i in (p+1..q-1)]
+     s := subString(pattern,p+1,q-p-1) --[pattern.i for i in (p+1..q-1)]
      i := stringPosition(s,target,i)
      if i = ltarget then return (returnFlag := true)
      i := i + #s
@@ -208,7 +208,7 @@ matchAnySegment?(pattern,target,k,nc) ==  --k = start position; nc=#chars or NIL
   returnFlag => false
   if p ~= q-1 then
      -- pattern does not end with a '&
-     s := SUBSTRING(pattern,p+1,q-p-1) --[pattern.i for i in (p+1..q-1)]
+     s := subString(pattern,p+1,q-p-1) --[pattern.i for i in (p+1..q-1)]
      if not suffix?(s,target) then return false
      if null ans then ans := 1  --pattern is a word preceded by a *
   true
diff --git a/src/interp/msgdb.boot b/src/interp/msgdb.boot
index 6d7ed990..9d650bd6 100644
--- a/src/interp/msgdb.boot
+++ b/src/interp/msgdb.boot
@@ -179,7 +179,7 @@ substituteSegmentedMsg(msg,args) ==
 
     -- x is a special case
     (n > 2) and c = char "%" and x.1 = char "k" =>
-        l := NCONC(nreverse pkey SUBSTRING(x,2,NIL),l)
+        l := NCONC(nreverse pkey subString(x,2),l)
 
     -- ?name gets replaced by '"Push PF10" or '"Type >b (enter)"
     (x.0 = char "?") and n > 1 and (v := pushOrTypeFuture(INTERN x,nil)) =>
@@ -581,7 +581,7 @@ brightPrint0(x,out == $OutputStream) ==
   -- it without the backslash.
 
   STRINGLENGTH x > 1 and x.0 = char "\" and x.1 = char "%" =>
-    sayString(SUBSTRING(x,1,NIL),out)
+    sayString(subString(x,1),out)
   x = '"%l" =>
     sayNewLine(out)
     for i in 1..$MARG repeat sayString('" ",out)
@@ -642,7 +642,7 @@ blankIndicator x ==
   if IDENTP x then x := PNAME x
   not string? x or MAXINDEX x < 1 => nil
   x.0 = char '% and x.1 = char 'x =>
-    MAXINDEX x > 1 => readInteger SUBSTRING(x,2,nil)
+    MAXINDEX x > 1 => readInteger subString(x,2)
     1
   nil
 
diff --git a/src/interp/newfort.boot b/src/interp/newfort.boot
index 4280503c..a31aefe2 100644
--- a/src/interp/newfort.boot
+++ b/src/interp/newfort.boot
@@ -320,8 +320,8 @@ fortran2Lines1 f ==
       -- legal format. MCD
       if (ll < $fortLength) and (ll + sff) > $fortLength then
         spaceLeft := $fortLength - ll
-        line := strconc(line,SUBSEQ(ff,0,spaceLeft))
-        ff := SUBSEQ(ff,spaceLeft)
+        line := strconc(line,subSequence(ff,0,spaceLeft))
+        ff := subSequence(ff,spaceLeft)
       lines := [line,:lines]
       ll := $fortIndent
       line := contPref
@@ -619,7 +619,7 @@ fortFormatLabelledIfGoto(switch,label1,label2) ==
   labString := STRINGIMAGE label1
   for i in #(labString)..5 repeat labString := strconc(labString,'" ")
   lines := fortran2Lines nreverse [:nreverse l,'"IF(",:r]
-  lines := [strconc(labString,SUBSEQ(first lines,6)),:rest lines]
+  lines := [strconc(labString,subSequence(first lines,6)),:rest lines]
   checkLines lines
 
 fortFormatIf(switch) ==
@@ -796,7 +796,7 @@ fortPre1 e ==
   imags := ['"%i","%i"]
   member(e, imags) => ['"CMPLX",fortPre1(0),fortPre1(1)]
   -- other special objects
-  STRINGIMAGE(e).0 = "%" => SUBSEQ(STRINGIMAGE e,1)
+  STRINGIMAGE(e).0 = char "%" => subSequence(STRINGIMAGE e,1)
   atom e => e
   [op, :args] := e
   member(op,["**" , '"**"]) =>
@@ -854,11 +854,11 @@ checkPrecision e ==
   string?(e) and codePoint CHAR(e,0) = 34 => e
   e := delete(char " ",STRINGIMAGE e)
   $fortranPrecision = "double" =>
-    iPart := SUBSEQ(e,0,(period:=POSITION(char ".",e))+1)
-    expt  := if ePos := POSITION(char "E",e) then SUBSEQ(e,ePos+1) else "0"
+    iPart := subSequence(e,0,(period:=POSITION(char ".",e))+1)
+    expt  := if ePos := POSITION(char "E",e) then subSequence(e,ePos+1) else "0"
     rPart :=
-      ePos => SUBSEQ(e,period+1,ePos)
-      period+1 < # e => SUBSEQ(e,period+1)
+      ePos => subSequence(e,period+1,ePos)
+      period+1 < # e => subSequence(e,period+1)
       "0"
     strconc(iPart,rPart,'"D",expt)
   e
diff --git a/src/interp/osyscmd.boot b/src/interp/osyscmd.boot
index 264bc3e2..c8623bbf 100644
--- a/src/interp/osyscmd.boot
+++ b/src/interp/osyscmd.boot
@@ -43,7 +43,7 @@ InterpExecuteSpadSystemCommand string ==
 ExecuteInterpSystemCommand string ==
    string := intProcessSynonyms(string)
    $currentLine:local:=string
-   string:=SUBSTRING(string,1,nil)
+   string:=subString(string,1)
    string = '"" => nil
    doSystemCommand string
 
diff --git a/src/interp/pathname.boot b/src/interp/pathname.boot
index 5887354a..3a741db8 100644
--- a/src/interp/pathname.boot
+++ b/src/interp/pathname.boot
@@ -115,7 +115,7 @@ newMKINFILENAM(infile) ==
       if fn = '"*" or fn = '"NIL" then sayKeyedMsg("S2IL0016",NIL)
       else              sayKeyedMsg("S2IL0003",[namestring file])
       ans := queryUserKeyedMsg("S2IL0017",NIL)
-      if (#(ans) > 0) and ('")" = SUBSTRING(ans,0,1)) then n := 2
+      if (#(ans) > 0) and ('")" = subString(ans,0,1)) then n := 2
       else n := 1
       nfn := UPCASE STRING2ID_-N(ans,n)
       (nfn = 0) or (nfn = 'QUIT) =>
diff --git a/src/interp/pf2atree.boot b/src/interp/pf2atree.boot
index 42453835..8bbd29be 100644
--- a/src/interp/pf2atree.boot
+++ b/src/interp/pf2atree.boot
@@ -417,15 +417,15 @@ pfSequence2Atree0(seqList, pf) ==
 --  float2Atree num ==
 --    eIndex := SEARCH('"e", num)
 --    mantPart :=
---      eIndex => SUBSEQ(num, 0, eIndex)
+--      eIndex => subSequence(num, 0, eIndex)
 --      num
---    expPart := (eIndex => READ_-FROM_-STRING SUBSEQ(num, eIndex+1); 0)
+--    expPart := (eIndex => READ_-FROM_-STRING subSequence(num, eIndex+1); 0)
 --    dotIndex := SEARCH('".", mantPart)
 --    intPart :=
---      dotIndex => READ_-FROM_-STRING SUBSEQ(mantPart, 0, dotIndex)
+--      dotIndex => READ_-FROM_-STRING subSequence(mantPart, 0, dotIndex)
 --      READ_-FROM_-STRING mantPart
 --    fracPartString :=
---      dotIndex => SUBSEQ(mantPart, dotIndex+1)
+--      dotIndex => subSequence(mantPart, dotIndex+1)
 --      '"0"
 --    bfForm := MAKE_-FLOAT(intPart, READ_-FROM_-STRING fracPartString,
 --      # fracPartString, expPart)
diff --git a/src/interp/pf2sex.boot b/src/interp/pf2sex.boot
index 1d7b6fb8..d00e4cd7 100644
--- a/src/interp/pf2sex.boot
+++ b/src/interp/pf2sex.boot
@@ -185,7 +185,7 @@ pfLiteral2Sex pf ==
     MULTIPLE_-VALUE_-BIND(part1 pos1,
       readInteger(txt,KEYWORD::JUNK_-ALLOWED,true),
         if pos1 = #txt then part1
-        else readInteger(SUBSTRING(txt,pos1+1,nil),
+        else readInteger(subString(txt,pos1+1),
                KEYWORD::RADIX, part1))
   type = 'string or type = 'char =>
     pfLiteralString pf
@@ -385,15 +385,15 @@ pfSequence2Sex0 seqList ==
 float2Sex num ==
   eIndex := SEARCH('"e", num)
   mantPart :=
-    eIndex => SUBSEQ(num, 0, eIndex)
+    eIndex => subSequence(num, 0, eIndex)
     num
-  expPart := (eIndex => READ_-FROM_-STRING SUBSEQ(num, eIndex+1); 0)
+  expPart := (eIndex => READ_-FROM_-STRING subSequence(num, eIndex+1); 0)
   dotIndex := SEARCH('".", mantPart)
   intPart :=
-    dotIndex => READ_-FROM_-STRING SUBSEQ(mantPart, 0, dotIndex)
+    dotIndex => READ_-FROM_-STRING subSequence(mantPart, 0, dotIndex)
     READ_-FROM_-STRING mantPart
   fracPartString :=
-    dotIndex => SUBSEQ(mantPart, dotIndex+1)
+    dotIndex => subSequence(mantPart, dotIndex+1)
     '"0"
   bfForm := MAKE_-FLOAT(intPart, READ_-FROM_-STRING fracPartString,
     # fracPartString, expPart)
diff --git a/src/interp/pspad1.boot b/src/interp/pspad1.boot
index a9d40822..a89253f9 100644
--- a/src/interp/pspad1.boot
+++ b/src/interp/pspad1.boot
@@ -152,8 +152,8 @@ mkCommentLines [.,n,.,s] ==
  
 breakComments s ==
   n:= containsString(s,PNAME "ENDOFLINECHR") =>
-    #s>n+12 => [SUBSTRING(s,0,n),:breakComments SUBSTRING(s,n+12,NIL)]
-    [SUBSTRING(s,0,n)]
+    #s>n+12 => [subString(s,0,n),:breakComments subString(s,n+12)]
+    [subString(s,0,n)]
   [s]
  
 containsString(x,y) ==
diff --git a/src/interp/pspad2.boot b/src/interp/pspad2.boot
index c5bf7aa8..6f23df70 100644
--- a/src/interp/pspad2.boot
+++ b/src/interp/pspad2.boot
@@ -496,9 +496,9 @@ consComments(s,plusPlus) ==
   while (m := MAXINDEX s) >= columnsLeft repeat
     k := or/[i for i in (columnsLeft - 1)..1 by -1 | s.i = $charBlank] 
     k := (k => k + 1; columnsLeft)
-    piece := SUBSTRING(s,0,k)
+    piece := subString(s,0,k)
     formatDoCommentLine [plusPlus,piece]
-    s := SUBSTRING(s,k,nil)
+    s := subString(s,k)
   formatDoCommentLine [plusPlus,s]
   undent()
   $m
@@ -508,7 +508,7 @@ consCommentsTran s ==
   k := or/[i for i in 0..(m - 7) | substring?('"\spad{",s,i)] =>
     r := charPosition(char '_},s,k + 6)
     r = m + 1 => s
-    strconc(SUBSTRING(s,0,k),'"`",SUBSTRING(s,k+6,r-k-6),'"'",consCommentsTran SUBSTRING(s,r+1,nil))
+    strconc(subString(s,0,k),'"`",subString(s,k+6,r-k-6),'"'",consCommentsTran subString(s,r+1))
   s
   
 formatDoCommentLine line ==
@@ -564,7 +564,7 @@ string2PrintImage s ==
  
 ident2PrintImage s ==
   m := MAXINDEX s
-  if m > 1 and s.(m - 1) = $underScore then s := strconc(SUBSTRING(s,0,m-1),s.m)
+  if m > 1 and s.(m - 1) = $underScore then s := strconc(subString(s,0,m-1),s.m)
   u:= GETSTR (2*# s)
   if not (alphabetic? s.0 or s.0 = char "$") then SUFFIX('__,u)
   u:= SUFFIX(s.0,u)
diff --git a/src/interp/record.boot b/src/interp/record.boot
index 7313b81c..c67d1922 100644
--- a/src/interp/record.boot
+++ b/src/interp/record.boot
@@ -238,14 +238,14 @@ htFile2InputFile(pathname,:option) ==
 htCommandToInputLine s == fn(s,0) where fn(s,init) ==
 --similar to htTrimAtBackSlash except removes all \
   k := or/[i for i in init..MAXINDEX s | s.i = char '_\] =>
-    member(s.(k + 1),[char 'f,char 'b]) => SUBSTRING(s,init,k - init)
-    strconc(SUBSTRING(s,init,k - init),fn(s,k + 1))
-  SUBSTRING(s,init,nil)
+    member(s.(k + 1),[char 'f,char 'b]) => subString(s,init,k - init)
+    strconc(subString(s,init,k - init),fn(s,k + 1))
+  subString(s,init)
  
 htTrimAtBackSlash s ==
   backslash := char '_\
   k := or/[i for i in 0..MAXINDEX s | s.i = backslash 
-          and member(s.(i + 1),[char 'f,char 'b])] => SUBSTRING(s,0,k - 1)
+          and member(s.(i + 1),[char 'f,char 'b])] => subString(s,0,k - 1)
   s
  
 htMkPath(directory,name,typ) ==
@@ -269,7 +269,7 @@ recordAndPrintTest md ==  --called by recordAndPrint
       x is [y,:r] =>     
         y.(k := MAXINDEX y) = char '__ => 
           u := fn r
-          [strconc(SUBSTRING(y,0,k),'" ",first u),:rest u]
+          [strconc(subString(y,0,k),'" ",first u),:rest u]
         [y,:fn r]
       x
   output := nreverse $mkTestOutputStack -- set by maPrin
diff --git a/src/interp/scan.boot b/src/interp/scan.boot
index 4aacb056..be05beec 100644
--- a/src/interp/scan.boot
+++ b/src/interp/scan.boot
@@ -291,7 +291,7 @@ lineoftoks(s)==
   toks := []
   a := incPrefix?('"command",1,$ln)
   a =>
-    $ln := SUBSTRING($ln,8,nil)
+    $ln := subString($ln,8)
     b := dqUnit constoken($ln,$linepos,["command",$ln],0)
     [[[b,s]],:$r]
   while $n<$sz repeat
@@ -428,12 +428,12 @@ startsNegComment?()==
 scanNegComment()==
   n := $n
   $n := $sz
-  lfnegcomment SUBSTRING($ln,n,nil)
+  lfnegcomment subString($ln,n)
 
 scanComment()==
   n := $n
   $n := $sz
-  lfcomment SUBSTRING($ln,n,nil)
+  lfcomment subString($ln,n)
 
 scanPunct()==
   sss := subMatch($ln,$n)
@@ -482,12 +482,12 @@ scanS()==
     $n:=$sz
     ncSoftError([$linepos,:lnExtraBlanks $linepos+$n],
             "S2CN0001",[])
-    SUBSTRING($ln,n,nil)
+    subString($ln,n)
   mn = strsym =>
     $n:=mn+1
-    SUBSTRING($ln,n,mn-n)
+    subString($ln,n,mn-n)
   --escape is found first
-  str := SUBSTRING($ln,n,mn-n)-- before escape
+  str := subString($ln,n,mn-n)-- before escape
   $n := mn+1
   a := scanEsc() -- case of end of line when false
   b :=
@@ -527,9 +527,9 @@ scanW(b)==             -- starts pointing to first char
   endid=l or QENUM($ln,endid) ~= ESCAPE =>
      -- not escaped
     $n:=endid
-    [b,SUBSTRING($ln,n1,endid-n1)]   -- l overflows
+    [b,subString($ln,n1,endid-n1)]   -- l overflows
   -- escape and endid ~= l
-  str := SUBSTRING($ln,n1,endid-n1)
+  str := subString($ln,n1,endid-n1)
   $n := endid+1
   a := scanEsc()
   bb :=
@@ -559,9 +559,9 @@ spleI1(dig,zro) ==
     $n := $n+1
   $n = l or QENUM($ln,$n) ~= ESCAPE =>
      n = $n and zro => '"0"
-     SUBSTRING($ln,n,$n-n)
+     subString($ln,n,$n-n)
   -- escaped
-  str:=SUBSTRING($ln,n,$n-n)
+  str:=subString($ln,n,$n-n)
   $n:=$n+1
   a:=scanEsc()
   bb:=spleI1(dig,zro)-- escape, anyno spaces are ignored
diff --git a/src/interp/server.boot b/src/interp/server.boot
index b1b6658f..cf7a6a01 100644
--- a/src/interp/server.boot
+++ b/src/interp/server.boot
@@ -152,7 +152,7 @@ parseAndEvalStr string ==
 
 parseAndEvalStr1 string ==
   string.0 = char ")" =>
-    doSystemCommand SUBSEQ(string, 1)
+    doSystemCommand subSequence(string, 1)
   processInteractive(ncParseFromString string, NIL)
 
 protectedEVAL x ==
diff --git a/src/interp/showimp.boot b/src/interp/showimp.boot
index f7456994..f60160d8 100644
--- a/src/interp/showimp.boot
+++ b/src/interp/showimp.boot
@@ -81,7 +81,7 @@ showImp(dom,:options) ==
   u := SORTBY('CDDR,defexports)
   while u repeat
     [.,.,:key] := first u
-    defop := INTERN(SUBSTRING((s := PNAME first key),0,MAXINDEX s))
+    defop := INTERN(subString((s := PNAME first key),0,MAXINDEX s))
     domainForm := [defop,:CDDR key]
     sayBrightly ["Default functions from",:bright form2String domainForm,'":"]
     u := showDomainsOp1(u,key)
diff --git a/src/interp/slam.boot b/src/interp/slam.boot
index 82d234c6..cc71b84b 100644
--- a/src/interp/slam.boot
+++ b/src/interp/slam.boot
@@ -108,7 +108,7 @@ isRecurrenceRelation(op,body,minivectorName) ==
   diffSlot := or/[i for i in 0.. for x in $minivector | EQ(x,diffCell)]
                 or return nil
   --Check general term for references to just the k previous values
-  sharpPosition := readInteger SUBSTRING(sharpArg,1,nil)
+  sharpPosition := readInteger subString(sharpArg,1)
   al:= mkDiffAssoc(op,generalTerm,k,sharpPosition,sharpArg,diffSlot,minivectorName)
   null al => false
   "$failed" in al => false
diff --git a/src/interp/sys-utility.boot b/src/interp/sys-utility.boot
index f113444f..e4722a68 100644
--- a/src/interp/sys-utility.boot
+++ b/src/interp/sys-utility.boot
@@ -372,5 +372,11 @@ writeByteToStreamSocket(s,b) ==
 makeByteBuffer(n,b == 0) ==
   MAKE_-ARRAY(n,KEYWORD::ELEMENT_-TYPE,"%Byte",KEYWORD::INITIAL_-ELEMENT,b)
 
+++ return the sub-string of `s' starting from `f'.
+++ When non-nil, `n' designates the length of the sub-string.
+subString(s,f,n == nil) ==
+  n = nil => subSequence(s,f)
+  subSequence(s,f,f + n)
+
 quoteForm t ==
   ["QUOTE",t]
diff --git a/src/interp/topics.boot b/src/interp/topics.boot
index 656a7dee..e02eeaee 100644
--- a/src/interp/topics.boot
+++ b/src/interp/topics.boot
@@ -100,7 +100,7 @@ mkTopicHashTable() ==                         --given $groupAssoc = ((extended .
     line := trimString line                   --3-n    ...
     m := MAXINDEX line                        --     (blank line) ...
     line.m ~= (char '_:) => systemError('"wrong heading")
-    con := INTERN SUBSTRING(line,0,m)
+    con := INTERN subString(line,0,m)
     alist := [lst while not EOFP instream and 
        not (blankLine? (line := READLINE instream)) and
          line.0 ~= char '_- for i in 1..
@@ -137,7 +137,7 @@ string2OpAlist s ==
   upperCase? s.k => nil       --skip constructor names
   k := 0
   while (k := skipBlanks(s,k,m)) repeat
-    acc := [INTERN SUBSTRING(s,k,-k + (k := charPosition(char '_ ,s,k + 1))),:acc]
+    acc := [INTERN subString(s,k,-k + (k := charPosition(char '_ ,s,k + 1))),:acc]
   acc := nreverse acc
   --now add defaults 
   if u := getDefaultProps first acc then acc := [first acc,:u,:rest acc]
diff --git a/src/interp/trace.boot b/src/interp/trace.boot
index 3ccfa57a..28fa8cb1 100644
--- a/src/interp/trace.boot
+++ b/src/interp/trace.boot
@@ -641,7 +641,7 @@ letPrint3(x,xval,printfn,currentFunction) ==
 getAliasIfTracedMapParameter(x,currentFunction) ==
   isSharpVarWithNum x =>
     aliasList:= get(currentFunction,'alias,$InteractiveFrame) =>
-      aliasList.(STRING2PINT_-N(SUBSTRING(PNAME x,1,NIL),1)-1)
+      aliasList.(STRING2PINT_-N(subString(PNAME x,1,NIL),1)-1)
   x
 
 getBpiNameIfTracedMap(name) ==
diff --git a/src/interp/word.boot b/src/interp/word.boot
index 16e26324..fc553899 100644
--- a/src/interp/word.boot
+++ b/src/interp/word.boot
@@ -99,7 +99,7 @@ getListOfFunctionNames(fnames) ==
     stream:= DEFIOSTREAM(['(MODE . INPUT),['FILE,fn,'DIRECT,'_*]],80,0)
     while (not PLACEP (x:= readLine stream)) repeat
       (s := # x) < 26 => 'iterate
-      res:= [SUBSTRING(x,26,NIL),:res]
+      res:= [subString(x,26),:res]
     SHUT stream
   res
  
@@ -112,12 +112,12 @@ wordsOfString1(s,j) ==
     tailWords:=
       isBreakCharacter s.(k+1) =>
         n:= or/[i for i in (k+2)..(MAXINDEX(s)-1)|not isBreakCharacter s.i]
-        null n => [SUBSTRING(s,k,nil)]
-        n > k+1 => [SUBSTRING(s,k,n-k-1),:wordsOfString1(s,n-1)]
+        null n => [subString(s,k)]
+        n > k+1 => [subString(s,k,n-k-1),:wordsOfString1(s,n-1)]
       m := or/[i for i in (k+2)..(MAXINDEX(s)-1) | isBreakCharacter s.i] =>
-        [SUBSTRING(s,k,m-k),:wordsOfString1(s,m)]
-      [SUBSTRING(s,k,nil)]
-    k > j+1 => [SUBSTRING(s,j,k-j),:tailWords]
+        [subString(s,k,m-k),:wordsOfString1(s,m)]
+      [subString(s,k)]
+    k > j+1 => [subString(s,j,k-j),:tailWords]
     tailWords
   nil
  
-- 
cgit v1.2.3