aboutsummaryrefslogtreecommitdiff
path: root/src/boot/strap/utility.clisp
diff options
context:
space:
mode:
Diffstat (limited to 'src/boot/strap/utility.clisp')
-rw-r--r--src/boot/strap/utility.clisp25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/boot/strap/utility.clisp b/src/boot/strap/utility.clisp
index e399057f..f10a1749 100644
--- a/src/boot/strap/utility.clisp
+++ b/src/boot/strap/utility.clisp
@@ -9,7 +9,13 @@
|scalarMember?| |listMember?| |reverse| |reverse!|
|lastNode| |append| |append!| |copyList| |substitute|
|substitute!| |setDifference| |applySubst| |applySubst!|
- |remove| |removeSymbol|))
+ |applySubstNQ| |remove| |removeSymbol|))
+
+(DECLAIM (FTYPE (FUNCTION (|%Thing| |%Thing| |%Thing|) |%Thing|)
+ |substitute|))
+
+(DECLAIM (FTYPE (FUNCTION (|%Thing| |%Thing| |%Thing|) |%Thing|)
+ |substitute!|))
(DECLAIM (FTYPE (FUNCTION ((|%List| |%Thing|) (|%List| |%Thing|))
(|%List| |%Thing|))
@@ -204,6 +210,23 @@
(CDR |p|))
(T |t|)))))
+(DEFUN |applySubstNQ| (|sl| |t|)
+ (PROG (|p| |tl| |hd|)
+ (RETURN
+ (COND
+ ((AND (CONSP |t|)
+ (PROGN (SETQ |hd| (CAR |t|)) (SETQ |tl| (CDR |t|)) T))
+ (COND
+ ((EQ |hd| 'QUOTE) |t|)
+ (T (SETQ |hd| (|applySubstNQ| |sl| |hd|))
+ (SETQ |tl| (|applySubstNQ| |sl| |tl|))
+ (COND
+ ((AND (EQ |hd| (CAR |t|)) (EQ |tl| (CDR |t|))) |t|)
+ (T (CONS |hd| |tl|))))))
+ ((AND (SYMBOLP |t|) (SETQ |p| (|assocSymbol| |t| |sl|)))
+ (CDR |p|))
+ (T |t|)))))
+
(DEFUN |setDifference| (|x| |y|)
(PROG (|a| |l| |p|)
(RETURN