Fix adjoin-term

The term passed in loses its tag on each call to apply-generic, so the
term must be re-constructed.
This commit is contained in:
Oliver Payne 2022-03-27 22:02:51 +01:00
parent f598b2c3f1
commit 8c12ac0e4c
1 changed files with 8 additions and 2 deletions

View File

@ -582,7 +582,13 @@
(tag (rest-terms termlist))))
(put 'empty-termlist? '(termlist) empty-termlist?)
(put 'adjoin-term '(term termlist) adjoin-term)
;; Term will have its tag removed by apply-generic. This needs to be
;; re-added for the next apply-generic call (needed to step into the
;; appropriate termlist implementation).
(put 'adjoin-term '(term termlist)
(lambda (term termlist)
(adjoin-term (apply make-term term)
termlist)))
(put 'make-sparse-termlist 'termlist
make-sparse)
@ -621,7 +627,7 @@
(lambda (terms) (tag (make-termlist terms))))
(put 'adjoin-term '(term sparse)
(lambda (term termlist)
(tag (adjoin-term term termlist))))
(tag (adjoin-term (apply make-term term) termlist))))
(put 'empty-termlist? '(sparse) empty-termlist?)
(put 'the-empty-termlist '(sparse)
(lambda ()