Subject: Re: [Maxima] puzzle with pattern matching
From: Richard Fateman
Date: Mon, 26 Aug 2002 14:54:34 -0700
;;Here is a replacement for a function in matcom.lisp that fixes the puzzle.
(DEFUN GETDEC (P E)
(LET (X Z)
(COND ((SETQ X (MGET P 'MATCHDECLARE))
(COND ((NOT (ATOM (CAR X))) (SETQ X (CAR X))))
(SETQ Z (NCONC (MAPCAR 'MEMQARGS (CDR X)) (NCONS E)))
(SETQ X (CAR X))
(COND ((NOT (ATOM X)) (SETQ X (CAR X))))
(SETQ Z
(COND ((OR (MEMQ X '($TRUE T $ALL))
(AND (FBOUNDP X) (NOT (GET X 'TRANSLATED))))
(CONS X Z))
(T ;(push (second z) *match-specials*)
`(IS (LIST '(,X),@Z))))) ;;changed 8/26/02/RJF
(COND ((MEMQ (CAR Z) '($TRUE T $ALL)) (LIST 'MSETQ P E))
(T (LIST 'COND
(LIST Z (LIST 'MSETQ P E))
'((MATCHERR)))))))))
;; Only one line is changed.
;; I have not run extensive testing on this, and I have not installed it
;; in Maxima CVS etc.