diff options
| author | dos-reis <gdr@axiomatics.org> | 2011-04-20 23:31:24 +0000 |
|---|---|---|
| committer | dos-reis <gdr@axiomatics.org> | 2011-04-20 23:31:24 +0000 |
| commit | 1ca37b944b566ef3f0479d4c2fe6895e9fbd3785 (patch) | |
| tree | e4d75111b770366bac08174a5bf47f4bdaaee1eb /src/interp | |
| parent | 1e67a3445ddda759c38b455494350ed00390d73f (diff) | |
| download | open-axiom-1ca37b944b566ef3f0479d4c2fe6895e9fbd3785.tar.gz | |
* interp/sys-utility.boot (substitute): Define.
(substitute!): Likewise.
* boot/utility.boot: Do not rely on tail recursion removal.
* boot/tokens.boot: Don't translate substitute and substitute!.
* boot/ast.boot (bfLp1): Tidy.
Diffstat (limited to 'src/interp')
| -rw-r--r-- | src/interp/as.boot | 2 | ||||
| -rw-r--r-- | src/interp/sys-utility.boot | 22 |
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 + |
