aboutsummaryrefslogtreecommitdiff
path: root/src/interp
diff options
context:
space:
mode:
Diffstat (limited to 'src/interp')
-rw-r--r--src/interp/as.boot2
-rw-r--r--src/interp/sys-utility.boot22
2 files changed, 23 insertions, 1 deletions
diff --git a/src/interp/as.boot b/src/interp/as.boot
index 7108d5a4..9bdaaf85 100644
--- a/src/interp/as.boot
+++ b/src/interp/as.boot
@@ -283,7 +283,7 @@ asGetModemaps(opAlist,oform,kind,modemap) ==
for [op,:itemlist] in SUBLISLIS(rpvl, $FormalMapVariableList,opAlist) repeat
for [sig0, pred] in itemlist repeat
sig := substitute(dc,"$",sig0)
- pred:= subtitute(dc,"$",pred)
+ pred:= substitute(dc,"$",pred)
sig := SUBLISLIS(rpvl,KDR oform,sig)
pred:= SUBLISLIS(rpvl,KDR oform,pred)
pred := pred or 'T
diff --git a/src/interp/sys-utility.boot b/src/interp/sys-utility.boot
index d047296e..6895926e 100644
--- a/src/interp/sys-utility.boot
+++ b/src/interp/sys-utility.boot
@@ -391,3 +391,25 @@ stringAssoc(s,l) ==
symbolLassoc(s,l) ==
p := symbolAssoc(s,l) => rest p
nil
+
+
+--% substitute
+
+substitute(new,old,tree) ==
+ sameObject?(old,tree) => new
+ cons? tree =>
+ h := substitute(new,old,first tree)
+ t := substitute(new,old,rest tree)
+ sameObject?(h,first tree) and sameObject?(t,rest tree) => tree
+ [h,:t]
+ tree
+
+substitute!(new,old,tree) ==
+ sameObject?(old,tree) => new
+ cons? tree =>
+ h := substitute!(new,old,first tree)
+ t := substitute!(new,old,rest tree)
+ tree.first := h
+ tree.rest := t
+ tree
+