aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorJay Belanger <[email protected]>2004-11-26 22:36:49 +0000
committerJay Belanger <[email protected]>2004-11-26 22:36:49 +0000
commit8b31b5197e387a61dadd33d40341170edc296826 (patch)
treea46c2a60f12d0ef53af764c848e506568d315196 /lisp
parent4952f0be950fda61cb64190df16047fb3f84b092 (diff)
(math-ms-temp, math-ms-args): New variables.
(math-multi-subst, math-multi-subst-rec): Replace variables temp and arg by declared variables. (calcFunc-reducer): Fixed incorrect variable. (math-inner-mul-func, math-inner-add-func): New variables. (calcFunc-inner, math-inner-mats): Replace variables mul-func and add-func by declared variables.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/calc/calc-map.el42
1 files changed, 28 insertions, 14 deletions
diff --git a/lisp/calc/calc-map.el b/lisp/calc/calc-map.el
index a6a5777df7..15a297e1ef 100644
--- a/lisp/calc/calc-map.el
+++ b/lisp/calc/calc-map.el
@@ -3,8 +3,7 @@
;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2004 Free Software Foundation, Inc.
;; Author: David Gillespie <[email protected]>
-;; Maintainers: D. Goel <[email protected]>
-;; Colin Walters <[email protected]>
+;; Maintainer: Jay Belanger <[email protected]>
;; This file is part of GNU Emacs.
@@ -802,25 +801,34 @@
(cons f args))))))
;;; Do substitutions in parallel to avoid crosstalk.
+
+;; The variables math-ms-temp and math-ms-args are local to
+;; math-multi-subst, but are used by math-multi-subst-rec, which
+;; is called by math-multi-subst.
+(defvar math-ms-temp)
+(defvar math-ms-args)
+
(defun math-multi-subst (expr olds news)
- (let ((args nil)
- temp)
+ (let ((math-ms-args nil)
+ math-ms-temp)
(while (and olds news)
- (setq args (cons (cons (car olds) (car news)) args)
+ (setq math-ms-args (cons (cons (car olds) (car news)) math-ms-args)
olds (cdr olds)
news (cdr news)))
(math-multi-subst-rec expr)))
(defun math-multi-subst-rec (expr)
- (cond ((setq temp (assoc expr args)) (cdr temp))
+ (cond ((setq math-ms-temp (assoc expr math-ms-args))
+ (cdr math-ms-temp))
((Math-primp expr) expr)
((and (eq (car expr) 'calcFunc-lambda) (> (length expr) 2))
(let ((new (list (car expr)))
- (args args))
+ (math-ms-args math-ms-args))
(while (cdr (setq expr (cdr expr)))
(setq new (cons (car expr) new))
- (if (assoc (car expr) args)
- (setq args (cons (cons (car expr) (car expr)) args))))
+ (if (assoc (car expr) math-ms-args)
+ (setq math-ms-args (cons (cons (car expr) (car expr))
+ math-ms-args))))
(nreverse (cons (math-multi-subst-rec (car expr)) new))))
(t
(cons (car expr)
@@ -1033,7 +1041,7 @@
(calcFunc-mod . math-mod)
(calcFunc-vconcat .
math-concat) )))
- lfunc)))
+ func)))
(while (cdr vec)
(setq expr (funcall lfunc expr (nth 1 vec))
vec (cdr vec)))))
@@ -1222,7 +1230,13 @@
(math-normalize (cons 'vec (nreverse mat)))))
-(defun calcFunc-inner (mul-func add-func a b)
+;; The variables math-inner-mul-func and math-inner-add-func are
+;; local to calcFunc-inner, but are used by math-inner-mats,
+;; which is called by math-inner-mats.
+(defvar math-inner-mul-func)
+(defvar math-inner-add-func)
+
+(defun calcFunc-inner (math-inner-mul-func math-inner-add-func a b)
(or (math-vectorp a) (math-reject-arg a 'vectorp))
(or (math-vectorp b) (math-reject-arg b 'vectorp))
(if (math-matrixp a)
@@ -1240,7 +1254,7 @@
(math-dimension-error))))
(if (math-matrixp b)
(nth 1 (math-inner-mats (list 'vec a) b))
- (calcFunc-reduce add-func (calcFunc-map mul-func a b)))))
+ (calcFunc-reduce math-inner-add-func (calcFunc-map math-inner-mul-func a b)))))
(defun math-inner-mats (a b)
(let ((mat nil)
@@ -1250,8 +1264,8 @@
(setq col cols
row nil)
(while (> (setq col (1- col)) 0)
- (setq row (cons (calcFunc-reduce add-func
- (calcFunc-map mul-func
+ (setq row (cons (calcFunc-reduce math-inner-add-func
+ (calcFunc-map math-inner-mul-func
(car a)
(math-mat-col b col)))
row)))