aboutsummaryrefslogtreecommitdiff
path: root/src/boot/utility.boot
diff options
context:
space:
mode:
Diffstat (limited to 'src/boot/utility.boot')
-rw-r--r--src/boot/utility.boot16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/boot/utility.boot b/src/boot/utility.boot
index 39973783..b00eac00 100644
--- a/src/boot/utility.boot
+++ b/src/boot/utility.boot
@@ -35,7 +35,10 @@ namespace BOOTTRAN
module utility (objectMember?, symbolMember?, stringMember?,
charMember?, scalarMember?, listMember?, reverse, reverse!,
lastNode, append, append!, copyList, substitute, substitute!,
- setDifference, applySubst, applySubst!,remove,removeSymbol) where
+ setDifference, applySubst, applySubst!, applySubstNQ,
+ remove,removeSymbol) where
+ substitute: (%Thing,%Thing,%Thing) -> %Thing
+ substitute!: (%Thing,%Thing,%Thing) -> %Thing
append: (%List %Thing,%List %Thing) -> %List %Thing
append!: (%List %Thing,%List %Thing) -> %List %Thing
copyList: %List %Thing -> %List %Thing
@@ -190,6 +193,17 @@ applySubst!(sl,t) ==
symbol? t and (p := assocSymbol(t,sl)) => rest p
t
+++ Like applySubst, but skip quoted materials.
+applySubstNQ(sl,t) ==
+ t is [hd,:tl] =>
+ hd is "QUOTE" => t
+ hd := applySubstNQ(sl,hd)
+ tl := applySubstNQ(sl,tl)
+ sameObject?(hd,first t) and sameObject?(tl,rest t) => t
+ [hd,:tl]
+ symbol? t and (p := assocSymbol(t,sl)) => rest p
+ t
+
--% set operations
setDifference(x,y) ==