[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



I just scanned over the uses of SUBST in macsyma, with
an interesting result. Except for uses of SUBST
as (SUBST NIL NIL X), almost all probably violate macsyma
data abstraction or are prone to subtle bugs of other kinds.
Many are due to a single programmer who hacked quite a few
years ago. 

Rational function package: 
; this uses a "special representation".
; macsyma "general representation" has its own SUBST function.

(SUBST (CAR V) 'FOO X) 
(SUBST 1 'FOO X)
(SUBST (SUB1 (CAR V))
       'FOO
       X)
(SUBST (CAR (LAST GENVAR))
       (CAR MINPOLY*)
       MINPOLY*)

(SUBST '%I '$%I P)
;; this is a violation of macsyma data abstraction, which just happens
;; to work in most cases.

GCD package:

;; an excerpt form a PROG, notice the COMMENT, which
;; is made up of PROG-TAGS. Neat eh?

 END  (GETD0 PL(SETQ VALS(SUBST 1. 0.  VALS))) WHAT WAS SUBST FOR?

TAYLOR package: ; again, it manipulates the "special representation".

(subst 'sp2var (cadr f) s)
(subst *i (caddr e) e))))
(setq x (subst i (sum-index x) x)) i)

Here is a jewel where a symbol is used which is the USERNAME of
a macsyma user that uses the package in question:

(SUBST 'ELL VAR NEWF)

Series package:

(setq sexp (subst var 'x sexp))

;; presumably this depends on the fact that a USER cannot type
;; in a symbol X, since all user symbols get a dollar-sign
;; stuck on the front. 


-gjc