aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Kangas2020-11-17 02:51:30 +0100
committerStefan Kangas2020-11-17 13:00:27 +0100
commit030ad21afecdd718ce741cff9666c1913a8211df (patch)
treeea9ea92b33dfb5a2b1f42fb111dc6be297a72615
parent0a7ec10ac621c210fbf87e4465cb05e378b79889 (diff)
downloademacs-030ad21afecdd718ce741cff9666c1913a8211df.tar.gz
emacs-030ad21afecdd718ce741cff9666c1913a8211df.zip
Don't quote lambdas with 'function' in calc/*.el
* lisp/calc/calc-aent.el (calc-do-quick-calc) (calc-do-calc-eval, math-build-parse-table): * lisp/calc/calc-alg.el (math-polynomial-base): * lisp/calc/calc-alg.el (math-is-poly-rec): * lisp/calc/calc-arith.el (calcFunc-scf): * lisp/calc/calc-arith.el (math-ceiling, math-round): * lisp/calc/calc-arith.el (math-trunc-fancy, math-floor-fancy): * lisp/calc/calc-ext.el (calc-init-extensions, calc-reset) (calc-refresh-top, calc-z-prefix-help, calc-binary-op-fancy) (calc-unary-op-fancy): * lisp/calc/calc-forms.el (math-make-mod): * lisp/calc/calc-frac.el (calcFunc-frac): * lisp/calc/calc-funcs.el (calcFunc-euler): * lisp/calc/calc-help.el (calc-full-help): * lisp/calc/calc-lang.el (c, pascal, fortran, tex, latex, eqn) (yacas, maxima, giac, math, maple): * lisp/calc/calc-macs.el (calc-wrapper, calc-slow-wrapper): * lisp/calc/calc-map.el (calc-get-operator, calcFunc-mapeqr) (calcFunc-reducea, calcFunc-rreducea, calcFunc-reduced) (calcFunc-rreduced, calcFunc-outer): * lisp/calc/calc-misc.el (another-calc, calc-do-handle-whys): * lisp/calc/calc-mode.el (calc-save-modes): * lisp/calc/calc-mtx.el (math-col-matrix, math-mul-mat-vec): * lisp/calc/calc-poly.el (math-sort-terms, math-poly-div-list) (math-mul-list, math-sort-poly-base-list) (math-partial-fractions): * lisp/calc/calc-prog.el (calc-user-define-formula): * lisp/calc/calc-rewr.el (math-rewrite, math-compile-patterns) (math-compile-rewrites, math-parse-schedule) (math-rwcomp-pattern): * lisp/calc/calc-store.el (calc-var-name-map, calc-let) (calc-permanent-variable, calc-insert-variables): * lisp/calc/calc-stuff.el (calc-flush-caches, calcFunc-pclean) (calcFunc-pfrac): * lisp/calc/calc-units.el (math-build-units-table) (math-decompose-units): * lisp/calc/calc-vec.el (calcFunc-mrow, math-mat-col) (calcFunc-mcol, math-mat-less-col, math-mimic-ident): * lisp/calc/calc-yank.el (calc-edit): * lisp/calc/calc.el (calc-mode-var-list-restore-default-values) (calc-mode-var-list-restore-saved-values, calc-mode, calc-quit): * lisp/calc/calccomp.el (math-compose-expr) (math-compose-matrix, math-vector-to-string): Don't quote lambdas with 'function'.
-rw-r--r--lisp/calc/calc-aent.el35
-rw-r--r--lisp/calc/calc-alg.el7
-rw-r--r--lisp/calc/calc-arith.el10
-rw-r--r--lisp/calc/calc-ext.el38
-rw-r--r--lisp/calc/calc-forms.el2
-rw-r--r--lisp/calc/calc-frac.el5
-rw-r--r--lisp/calc/calc-funcs.el11
-rw-r--r--lisp/calc/calc-help.el50
-rw-r--r--lisp/calc/calc-lang.el364
-rw-r--r--lisp/calc/calc-macs.el6
-rw-r--r--lisp/calc/calc-map.el43
-rw-r--r--lisp/calc/calc-misc.el11
-rw-r--r--lisp/calc/calc-mode.el2
-rw-r--r--lisp/calc/calc-mtx.el6
-rw-r--r--lisp/calc/calc-poly.el21
-rw-r--r--lisp/calc/calc-prog.el14
-rw-r--r--lisp/calc/calc-rewr.el77
-rw-r--r--lisp/calc/calc-store.el71
-rw-r--r--lisp/calc/calc-stuff.el6
-rw-r--r--lisp/calc/calc-units.el40
-rw-r--r--lisp/calc/calc-vec.el18
-rw-r--r--lisp/calc/calc-yank.el11
-rw-r--r--lisp/calc/calc.el11
-rw-r--r--lisp/calc/calccomp.el117
24 files changed, 468 insertions, 508 deletions
diff --git a/lisp/calc/calc-aent.el b/lisp/calc/calc-aent.el
index 6c162b55f7b..338f0ea43e0 100644
--- a/lisp/calc/calc-aent.el
+++ b/lisp/calc/calc-aent.el
@@ -76,8 +76,8 @@
76 (calc-refresh-evaltos (nth 2 (nth 1 (car alg-exp)))) 76 (calc-refresh-evaltos (nth 2 (nth 1 (car alg-exp))))
77 (setq alg-exp (list (nth 2 (car alg-exp))))) 77 (setq alg-exp (list (nth 2 (car alg-exp)))))
78 (setq calc-quick-prev-results alg-exp 78 (setq calc-quick-prev-results alg-exp
79 buf (mapconcat (function (lambda (x) 79 buf (mapconcat (lambda (x)
80 (math-format-value x 1000))) 80 (math-format-value x 1000))
81 alg-exp 81 alg-exp
82 " ") 82 " ")
83 shortbuf buf) 83 shortbuf buf)
@@ -197,18 +197,17 @@
197 (calc-language (if (memq calc-language '(nil big)) 197 (calc-language (if (memq calc-language '(nil big))
198 'flat calc-language)) 198 'flat calc-language))
199 (calc-dollar-values (mapcar 199 (calc-dollar-values (mapcar
200 (function 200 (lambda (x)
201 (lambda (x) 201 (if (stringp x)
202 (if (stringp x) 202 (progn
203 (progn 203 (setq x (math-read-exprs x))
204 (setq x (math-read-exprs x)) 204 (if (eq (car-safe x)
205 (if (eq (car-safe x) 205 'error)
206 'error) 206 (throw 'calc-error
207 (throw 'calc-error 207 (calc-eval-error
208 (calc-eval-error 208 (cdr x)))
209 (cdr x))) 209 (car x)))
210 (car x))) 210 x))
211 x)))
212 args)) 211 args))
213 (calc-dollar-used 0) 212 (calc-dollar-used 0)
214 (res (if (stringp str) 213 (res (if (stringp str)
@@ -640,10 +639,10 @@ in Calc algebraic input.")
640 (math-find-user-tokens (car (car p))) 639 (math-find-user-tokens (car (car p)))
641 (setq p (cdr p))) 640 (setq p (cdr p)))
642 (setq calc-user-tokens (mapconcat 'identity 641 (setq calc-user-tokens (mapconcat 'identity
643 (sort (mapcar 'car math-toks) 642 (sort (mapcar #'car math-toks)
644 (function (lambda (x y) 643 (lambda (x y)
645 (> (length x) 644 (> (length x)
646 (length y))))) 645 (length y))))
647 "\\|") 646 "\\|")
648 calc-last-main-parse-table mtab 647 calc-last-main-parse-table mtab
649 calc-last-user-lang-parse-table ltab 648 calc-last-user-lang-parse-table ltab
diff --git a/lisp/calc/calc-alg.el b/lisp/calc/calc-alg.el
index efb68395f7e..53ca01d9516 100644
--- a/lisp/calc/calc-alg.el
+++ b/lisp/calc/calc-alg.el
@@ -1785,7 +1785,7 @@ and should return the simplified expression to use (or nil)."
1785 (cons (nth 2 expr) math-poly-neg-powers)))) 1785 (cons (nth 2 expr) math-poly-neg-powers))))
1786 (not (Math-zerop (nth 2 expr))) 1786 (not (Math-zerop (nth 2 expr)))
1787 (let ((p1 (math-is-poly-rec (nth 1 expr) negpow))) 1787 (let ((p1 (math-is-poly-rec (nth 1 expr) negpow)))
1788 (mapcar (function (lambda (x) (math-div x (nth 2 expr)))) 1788 (mapcar (lambda (x) (math-div x (nth 2 expr)))
1789 p1)))) 1789 p1))))
1790 ((and (eq (car expr) 'calcFunc-exp) 1790 ((and (eq (car expr) 'calcFunc-exp)
1791 (equal math-var '(var e var-e))) 1791 (equal math-var '(var e var-e)))
@@ -1838,8 +1838,9 @@ and should return the simplified expression to use (or nil)."
1838(defun math-polynomial-base (top-expr &optional pred) 1838(defun math-polynomial-base (top-expr &optional pred)
1839 "Find the variable (or sub-expression) which is the base of polynomial expr." 1839 "Find the variable (or sub-expression) which is the base of polynomial expr."
1840 (let ((math-poly-base-pred 1840 (let ((math-poly-base-pred
1841 (or pred (function (lambda (base) (math-polynomial-p 1841 (or pred (lambda (base)
1842 top-expr base)))))) 1842 (math-polynomial-p
1843 top-expr base)))))
1843 (or (let ((math-poly-base-const-ok nil)) 1844 (or (let ((math-poly-base-const-ok nil))
1844 (math-polynomial-base-rec top-expr)) 1845 (math-polynomial-base-rec top-expr))
1845 (let ((math-poly-base-const-ok t)) 1846 (let ((math-poly-base-const-ok t))
diff --git a/lisp/calc/calc-arith.el b/lisp/calc/calc-arith.el
index ae397c4f2c4..c11cecfd545 100644
--- a/lisp/calc/calc-arith.el
+++ b/lisp/calc/calc-arith.el
@@ -2390,7 +2390,7 @@
2390 (math-trunc (nth 3 a))))) 2390 (math-trunc (nth 3 a)))))
2391 ((math-provably-integerp a) a) 2391 ((math-provably-integerp a) a)
2392 ((Math-vectorp a) 2392 ((Math-vectorp a)
2393 (math-map-vec (function (lambda (x) (math-trunc x math-trunc-prec))) a)) 2393 (math-map-vec (lambda (x) (math-trunc x math-trunc-prec)) a))
2394 ((math-infinitep a) 2394 ((math-infinitep a)
2395 (if (or (math-posp a) (math-negp a)) 2395 (if (or (math-posp a) (math-negp a))
2396 a 2396 a
@@ -2453,7 +2453,7 @@
2453 (math-add (math-floor (nth 3 a)) -1) 2453 (math-add (math-floor (nth 3 a)) -1)
2454 (math-floor (nth 3 a))))) 2454 (math-floor (nth 3 a)))))
2455 ((Math-vectorp a) 2455 ((Math-vectorp a)
2456 (math-map-vec (function (lambda (x) (math-floor x math-floor-prec))) a)) 2456 (math-map-vec (lambda (x) (math-floor x math-floor-prec)) a))
2457 ((math-infinitep a) 2457 ((math-infinitep a)
2458 (if (or (math-posp a) (math-negp a)) 2458 (if (or (math-posp a) (math-negp a))
2459 a 2459 a
@@ -2520,7 +2520,7 @@
2520 (math-ceiling (nth 2 a))) 2520 (math-ceiling (nth 2 a)))
2521 (math-ceiling (nth 3 a)))) 2521 (math-ceiling (nth 3 a))))
2522 ((Math-vectorp a) 2522 ((Math-vectorp a)
2523 (math-map-vec (function (lambda (x) (math-ceiling x prec))) a)) 2523 (math-map-vec (lambda (x) (math-ceiling x prec)) a))
2524 ((math-infinitep a) 2524 ((math-infinitep a)
2525 (if (or (math-posp a) (math-negp a)) 2525 (if (or (math-posp a) (math-negp a))
2526 a 2526 a
@@ -2573,7 +2573,7 @@
2573 ((eq (car a) 'intv) 2573 ((eq (car a) 'intv)
2574 (math-floor (math-add a '(frac 1 2)))) 2574 (math-floor (math-add a '(frac 1 2))))
2575 ((Math-vectorp a) 2575 ((Math-vectorp a)
2576 (math-map-vec (function (lambda (x) (math-round x prec))) a)) 2576 (math-map-vec (lambda (x) (math-round x prec)) a))
2577 ((math-infinitep a) 2577 ((math-infinitep a)
2578 (if (or (math-posp a) (math-negp a)) 2578 (if (or (math-posp a) (math-negp a))
2579 a 2579 a
@@ -2656,7 +2656,7 @@
2656 (calcFunc-scf (nth 2 x) n) 2656 (calcFunc-scf (nth 2 x) n)
2657 (calcFunc-scf (nth 3 x) n)))) 2657 (calcFunc-scf (nth 3 x) n))))
2658 ((eq (car x) 'vec) 2658 ((eq (car x) 'vec)
2659 (math-map-vec (function (lambda (x) (calcFunc-scf x n))) x)) 2659 (math-map-vec (lambda (x) (calcFunc-scf x n)) x))
2660 ((math-infinitep x) 2660 ((math-infinitep x)
2661 x) 2661 x)
2662 (t 2662 (t
diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el
index 23248ce1bd5..4877fa6e08c 100644
--- a/lisp/calc/calc-ext.el
+++ b/lisp/calc/calc-ext.el
@@ -678,14 +678,13 @@
678 678
679 (calc-init-prefixes) 679 (calc-init-prefixes)
680 680
681 (mapc (function 681 (mapc (lambda (x)
682 (lambda (x)
683 (define-key calc-mode-map (format "c%c" x) 'calc-clean-num) 682 (define-key calc-mode-map (format "c%c" x) 'calc-clean-num)
684 (define-key calc-mode-map (format "j%c" x) 'calc-select-part) 683 (define-key calc-mode-map (format "j%c" x) 'calc-select-part)
685 (define-key calc-mode-map (format "r%c" x) 'calc-recall-quick) 684 (define-key calc-mode-map (format "r%c" x) 'calc-recall-quick)
686 (define-key calc-mode-map (format "s%c" x) 'calc-store-quick) 685 (define-key calc-mode-map (format "s%c" x) 'calc-store-quick)
687 (define-key calc-mode-map (format "t%c" x) 'calc-store-into-quick) 686 (define-key calc-mode-map (format "t%c" x) 'calc-store-into-quick)
688 (define-key calc-mode-map (format "u%c" x) 'calc-quick-units))) 687 (define-key calc-mode-map (format "u%c" x) 'calc-quick-units))
689 "0123456789") 688 "0123456789")
690 689
691 (let ((i ?A)) 690 (let ((i ?A))
@@ -711,9 +710,9 @@
711 (define-key calc-alg-map "\e\177" 'calc-pop-above) 710 (define-key calc-alg-map "\e\177" 'calc-pop-above)
712 711
713;;;; (Autoloads here) 712;;;; (Autoloads here)
714 (mapc (function (lambda (x) 713 (mapc (lambda (x)
715 (mapcar (function (lambda (func) (autoload func (car x)))) 714 (mapcar (lambda (func) (autoload func (car x)))
716 (cdr x)))) 715 (cdr x)))
717 '( 716 '(
718 717
719 ("calc-alg" calc-has-rules math-defsimplify 718 ("calc-alg" calc-has-rules math-defsimplify
@@ -980,9 +979,9 @@ calc-force-refresh calc-locate-cursor-element calc-show-edit-buffer)
980 979
981)) 980))
982 981
983 (mapcar (function (lambda (x) 982 (mapcar (lambda (x)
984 (mapcar (function (lambda (cmd) (autoload cmd (car x) nil t))) 983 (mapcar (lambda (cmd) (autoload cmd (car x) nil t))
985 (cdr x)))) 984 (cdr x)))
986 '( 985 '(
987 986
988 ("calc-alg" calc-alg-evaluate calc-apart calc-collect calc-expand 987 ("calc-alg" calc-alg-evaluate calc-apart calc-collect calc-expand
@@ -1358,7 +1357,7 @@ calc-kill calc-kill-region calc-yank))))
1358 calc-redo-list nil) 1357 calc-redo-list nil)
1359 (let (calc-stack calc-user-parse-tables calc-standard-date-formats 1358 (let (calc-stack calc-user-parse-tables calc-standard-date-formats
1360 calc-invocation-macro) 1359 calc-invocation-macro)
1361 (mapc (function (lambda (v) (set v nil))) calc-local-var-list) 1360 (mapc (lambda (v) (set v nil)) calc-local-var-list)
1362 (if (and arg (<= arg 0)) 1361 (if (and arg (<= arg 0))
1363 (calc-mode-var-list-restore-default-values) 1362 (calc-mode-var-list-restore-default-values)
1364 (calc-mode-var-list-restore-saved-values))) 1363 (calc-mode-var-list-restore-saved-values)))
@@ -1658,7 +1657,7 @@ calc-kill calc-kill-region calc-yank))))
1658 (calc-pop-stack n 1 t) 1657 (calc-pop-stack n 1 t)
1659 (calc-push-list (mapcar #'car entries) 1658 (calc-push-list (mapcar #'car entries)
1660 1 1659 1
1661 (mapcar (function (lambda (x) (nth 2 x))) 1660 (mapcar (lambda (x) (nth 2 x))
1662 entries))))))) 1661 entries)))))))
1663 1662
1664(defvar calc-refreshing-evaltos nil) 1663(defvar calc-refreshing-evaltos nil)
@@ -1924,11 +1923,10 @@ calc-kill calc-kill-region calc-yank))))
1924 (let* ((calc-z-prefix-msgs nil) 1923 (let* ((calc-z-prefix-msgs nil)
1925 (calc-z-prefix-buf "") 1924 (calc-z-prefix-buf "")
1926 (kmap (sort (copy-sequence (calc-user-key-map)) 1925 (kmap (sort (copy-sequence (calc-user-key-map))
1927 (function (lambda (x y) (< (car x) (car y)))))) 1926 (lambda (x y) (< (car x) (car y)))))
1928 (flags (apply #'logior 1927 (flags (apply #'logior
1929 (mapcar (function 1928 (mapcar (lambda (k)
1930 (lambda (k) 1929 (calc-user-function-classify (car k)))
1931 (calc-user-function-classify (car k))))
1932 kmap)))) 1930 kmap))))
1933 (if (= (logand flags 8) 0) 1931 (if (= (logand flags 8) 0)
1934 (calc-user-function-list kmap 7) 1932 (calc-user-function-list kmap 7)
@@ -2633,9 +2631,8 @@ If X is not an error form, return 1."
2633 (let ((rhs (calc-top-n 1))) 2631 (let ((rhs (calc-top-n 1)))
2634 (calc-enter-result (- 1 n) 2632 (calc-enter-result (- 1 n)
2635 name 2633 name
2636 (mapcar (function 2634 (mapcar (lambda (x)
2637 (lambda (x) 2635 (list func x rhs))
2638 (list func x rhs)))
2639 (calc-top-list-n (- n) 2)))))))) 2636 (calc-top-list-n (- n) 2))))))))
2640 2637
2641(defun calc-unary-op-fancy (name func arg) 2638(defun calc-unary-op-fancy (name func arg)
@@ -2644,9 +2641,8 @@ If X is not an error form, return 1."
2644 (cond ((> n 0) 2641 (cond ((> n 0)
2645 (calc-enter-result n 2642 (calc-enter-result n
2646 name 2643 name
2647 (mapcar (function 2644 (mapcar (lambda (x)
2648 (lambda (x) 2645 (list func x))
2649 (list func x)))
2650 (calc-top-list-n n)))) 2646 (calc-top-list-n n))))
2651 ((< n 0) 2647 ((< n 0)
2652 (calc-enter-result 1 2648 (calc-enter-result 1
diff --git a/lisp/calc/calc-forms.el b/lisp/calc/calc-forms.el
index 465d4520b05..39116bfde99 100644
--- a/lisp/calc/calc-forms.el
+++ b/lisp/calc/calc-forms.el
@@ -2129,7 +2129,7 @@ and ends on the last Sunday of October at 2 a.m."
2129 ((memq (car n) '(+ - / vec neg)) 2129 ((memq (car n) '(+ - / vec neg))
2130 (math-normalize 2130 (math-normalize
2131 (cons (car n) 2131 (cons (car n)
2132 (mapcar (function (lambda (x) (math-make-mod x m))) 2132 (mapcar (lambda (x) (math-make-mod x m))
2133 (cdr n))))) 2133 (cdr n)))))
2134 ((and (eq (car n) '*) (Math-anglep (nth 1 n))) 2134 ((and (eq (car n) '*) (Math-anglep (nth 1 n)))
2135 (math-mul (math-make-mod (nth 1 n) m) (nth 2 n))) 2135 (math-mul (math-make-mod (nth 1 n) m) (nth 2 n)))
diff --git a/lisp/calc/calc-frac.el b/lisp/calc/calc-frac.el
index 86a4808c5ad..1d6895caa3a 100644
--- a/lisp/calc/calc-frac.el
+++ b/lisp/calc/calc-frac.el
@@ -132,9 +132,8 @@
132 (cond ((Math-ratp a) 132 (cond ((Math-ratp a)
133 a) 133 a)
134 ((memq (car a) '(cplx polar vec hms date sdev intv mod)) 134 ((memq (car a) '(cplx polar vec hms date sdev intv mod))
135 (cons (car a) (mapcar (function 135 (cons (car a) (mapcar (lambda (x)
136 (lambda (x) 136 (calcFunc-frac x tol))
137 (calcFunc-frac x tol)))
138 (cdr a)))) 137 (cdr a))))
139 ((Math-messy-integerp a) 138 ((Math-messy-integerp a)
140 (math-trunc a)) 139 (math-trunc a))
diff --git a/lisp/calc/calc-funcs.el b/lisp/calc/calc-funcs.el
index 5c179ff05d4..9ee86e755ea 100644
--- a/lisp/calc/calc-funcs.el
+++ b/lisp/calc/calc-funcs.el
@@ -797,12 +797,11 @@
797 (math-reduce-vec 797 (math-reduce-vec
798 'math-add 798 'math-add
799 (cons 'vec 799 (cons 'vec
800 (mapcar (function 800 (mapcar (lambda (c)
801 (lambda (c) 801 (setq k (1+ k))
802 (setq k (1+ k)) 802 (math-mul (math-mul fac c)
803 (math-mul (math-mul fac c) 803 (math-sub (math-pow x1 k)
804 (math-sub (math-pow x1 k) 804 (math-pow x2 k))))
805 (math-pow x2 k)))))
806 coefs))) 805 coefs)))
807 x))) 806 x)))
808 (math-mul (math-pow 2 n) 807 (math-mul (math-pow 2 n)
diff --git a/lisp/calc/calc-help.el b/lisp/calc/calc-help.el
index 0b327e8d0f6..06b4b9684e3 100644
--- a/lisp/calc/calc-help.el
+++ b/lisp/calc/calc-help.el
@@ -402,32 +402,32 @@ C-w Describe how there is no warranty for Calc."
402 "Or type `h i' to read the full Calc manual on-line.\n\n")) 402 "Or type `h i' to read the full Calc manual on-line.\n\n"))
403 (princ "Basic keys:\n") 403 (princ "Basic keys:\n")
404 (let* ((calc-full-help-flag t)) 404 (let* ((calc-full-help-flag t))
405 (mapc (function (lambda (x) (princ (format 405 (mapc (lambda (x)
406 " %s\n" 406 (princ (format
407 (substitute-command-keys x))))) 407 " %s\n"
408 (substitute-command-keys x))))
408 (nreverse (cdr (reverse (cdr (calc-help)))))) 409 (nreverse (cdr (reverse (cdr (calc-help))))))
409 (mapc (function (lambda (prefix) 410 (mapc (lambda (prefix)
410 (let ((msgs (ignore-errors (funcall prefix)))) 411 (let ((msgs (ignore-errors (funcall prefix))))
411 (if (car msgs) 412 (if (car msgs)
412 (princ 413 (princ
413 (if (eq (nth 2 msgs) ?v) 414 (if (eq (nth 2 msgs) ?v)
414 (format-message 415 (format-message
415 "\n`v' or `V' prefix (vector/matrix) keys: \n") 416 "\n`v' or `V' prefix (vector/matrix) keys: \n")
416 (if (nth 2 msgs) 417 (if (nth 2 msgs)
417 (format-message 418 (format-message
418 "\n`%c' prefix (%s) keys:\n" 419 "\n`%c' prefix (%s) keys:\n"
419 (nth 2 msgs) 420 (nth 2 msgs)
420 (or (cdr (assq (nth 2 msgs) 421 (or (cdr (assq (nth 2 msgs)
421 calc-help-long-names)) 422 calc-help-long-names))
422 (nth 1 msgs))) 423 (nth 1 msgs)))
423 (format "\n%s-modified keys:\n" 424 (format "\n%s-modified keys:\n"
424 (capitalize (nth 1 msgs))))))) 425 (capitalize (nth 1 msgs)))))))
425 (mapcar (function 426 (mapcar (lambda (x)
426 (lambda (x) 427 (princ (format
427 (princ (format 428 " %s\n"
428 " %s\n" 429 (substitute-command-keys x))))
429 (substitute-command-keys x))))) 430 (car msgs))))
430 (car msgs)))))
431 '(calc-inverse-prefix-help 431 '(calc-inverse-prefix-help
432 calc-hyperbolic-prefix-help 432 calc-hyperbolic-prefix-help
433 calc-inv-hyp-prefix-help 433 calc-inv-hyp-prefix-help
diff --git a/lisp/calc/calc-lang.el b/lisp/calc/calc-lang.el
index bde5abe649f..283069446e0 100644
--- a/lisp/calc/calc-lang.el
+++ b/lisp/calc/calc-lang.el
@@ -175,20 +175,19 @@
175(put 'c 'math-vector-brackets "{}") 175(put 'c 'math-vector-brackets "{}")
176 176
177(put 'c 'math-radix-formatter 177(put 'c 'math-radix-formatter
178 (function (lambda (r s) 178 (lambda (r s)
179 (if (= r 16) (format "0x%s" s) 179 (if (= r 16) (format "0x%s" s)
180 (if (= r 8) (format "0%s" s) 180 (if (= r 8) (format "0%s" s)
181 (format "%d#%s" r s)))))) 181 (format "%d#%s" r s)))))
182 182
183(put 'c 'math-compose-subscr 183(put 'c 'math-compose-subscr
184 (function 184 (lambda (a)
185 (lambda (a) 185 (let ((args (cdr (cdr a))))
186 (let ((args (cdr (cdr a)))) 186 (list 'horiz
187 (list 'horiz 187 (math-compose-expr (nth 1 a) 1000)
188 (math-compose-expr (nth 1 a) 1000) 188 "["
189 "[" 189 (math-compose-vector args ", " 0)
190 (math-compose-vector args ", " 0) 190 "]"))))
191 "]")))))
192 191
193(add-to-list 'calc-lang-slash-idiv 'c) 192(add-to-list 'calc-lang-slash-idiv 'c)
194(add-to-list 'calc-lang-allow-underscores 'c) 193(add-to-list 'calc-lang-allow-underscores 'c)
@@ -238,9 +237,9 @@
238(put 'pascal 'math-output-filter 'calc-output-case-filter) 237(put 'pascal 'math-output-filter 'calc-output-case-filter)
239 238
240(put 'pascal 'math-radix-formatter 239(put 'pascal 'math-radix-formatter
241 (function (lambda (r s) 240 (lambda (r s)
242 (if (= r 16) (format "$%s" s) 241 (if (= r 16) (format "$%s" s)
243 (format "%d#%s" r s))))) 242 (format "%d#%s" r s))))
244 243
245(put 'pascal 'math-lang-read-symbol 244(put 'pascal 'math-lang-read-symbol
246 '((?\$ 245 '((?\$
@@ -253,17 +252,16 @@
253 math-exp-pos (match-end 1))))) 252 math-exp-pos (match-end 1)))))
254 253
255(put 'pascal 'math-compose-subscr 254(put 'pascal 'math-compose-subscr
256 (function 255 (lambda (a)
257 (lambda (a) 256 (let ((args (cdr (cdr a))))
258 (let ((args (cdr (cdr a)))) 257 (while (eq (car-safe (nth 1 a)) 'calcFunc-subscr)
259 (while (eq (car-safe (nth 1 a)) 'calcFunc-subscr) 258 (setq args (append (cdr (cdr (nth 1 a))) args)
260 (setq args (append (cdr (cdr (nth 1 a))) args) 259 a (nth 1 a)))
261 a (nth 1 a))) 260 (list 'horiz
262 (list 'horiz 261 (math-compose-expr (nth 1 a) 1000)
263 (math-compose-expr (nth 1 a) 1000) 262 "["
264 "[" 263 (math-compose-vector args ", " 0)
265 (math-compose-vector args ", " 0) 264 "]"))))
266 "]")))))
267 265
268(add-to-list 'calc-lang-allow-underscores 'pascal) 266(add-to-list 'calc-lang-allow-underscores 'pascal)
269(add-to-list 'calc-lang-brackets-are-subscripts 'pascal) 267(add-to-list 'calc-lang-brackets-are-subscripts 'pascal)
@@ -350,17 +348,16 @@
350 math-exp-pos (match-end 0))))) 348 math-exp-pos (match-end 0)))))
351 349
352(put 'fortran 'math-compose-subscr 350(put 'fortran 'math-compose-subscr
353 (function 351 (lambda (a)
354 (lambda (a) 352 (let ((args (cdr (cdr a))))
355 (let ((args (cdr (cdr a)))) 353 (while (eq (car-safe (nth 1 a)) 'calcFunc-subscr)
356 (while (eq (car-safe (nth 1 a)) 'calcFunc-subscr) 354 (setq args (append (cdr (cdr (nth 1 a))) args)
357 (setq args (append (cdr (cdr (nth 1 a))) args) 355 a (nth 1 a)))
358 a (nth 1 a))) 356 (list 'horiz
359 (list 'horiz 357 (math-compose-expr (nth 1 a) 1000)
360 (math-compose-expr (nth 1 a) 1000) 358 "("
361 "(" 359 (math-compose-vector args ", " 0)
362 (math-compose-vector args ", " 0) 360 ")"))))
363 ")")))))
364 361
365(add-to-list 'calc-lang-slash-idiv 'fortran) 362(add-to-list 'calc-lang-slash-idiv 'fortran)
366(add-to-list 'calc-lang-allow-underscores 'fortran) 363(add-to-list 'calc-lang-allow-underscores 'fortran)
@@ -598,18 +595,17 @@
598(put 'tex 'math-input-filter 'math-tex-input-filter) 595(put 'tex 'math-input-filter 'math-tex-input-filter)
599 596
600(put 'tex 'math-matrix-formatter 597(put 'tex 'math-matrix-formatter
601 (function 598 (lambda (a)
602 (lambda (a) 599 (if (and (integerp calc-language-option)
603 (if (and (integerp calc-language-option) 600 (or (= calc-language-option 0)
604 (or (= calc-language-option 0) 601 (> calc-language-option 1)
605 (> calc-language-option 1) 602 (< calc-language-option -1)))
606 (< calc-language-option -1))) 603 (append '(vleft 0 "\\matrix{")
607 (append '(vleft 0 "\\matrix{") 604 (math-compose-tex-matrix (cdr a))
608 (math-compose-tex-matrix (cdr a)) 605 '("}"))
609 '("}")) 606 (append '(horiz "\\matrix{ ")
610 (append '(horiz "\\matrix{ ") 607 (math-compose-tex-matrix (cdr a))
611 (math-compose-tex-matrix (cdr a)) 608 '(" }")))))
612 '(" }"))))))
613 609
614(put 'tex 'math-var-formatter 'math-compose-tex-var) 610(put 'tex 'math-var-formatter 'math-compose-tex-var)
615 611
@@ -839,18 +835,17 @@
839(put 'latex 'math-complex-format 'i) 835(put 'latex 'math-complex-format 'i)
840 836
841(put 'latex 'math-matrix-formatter 837(put 'latex 'math-matrix-formatter
842 (function 838 (lambda (a)
843 (lambda (a) 839 (if (and (integerp calc-language-option)
844 (if (and (integerp calc-language-option) 840 (or (= calc-language-option 0)
845 (or (= calc-language-option 0) 841 (> calc-language-option 1)
846 (> calc-language-option 1) 842 (< calc-language-option -1)))
847 (< calc-language-option -1))) 843 (append '(vleft 0 "\\begin{pmatrix}")
848 (append '(vleft 0 "\\begin{pmatrix}") 844 (math-compose-tex-matrix (cdr a) t)
849 (math-compose-tex-matrix (cdr a) t) 845 '("\\end{pmatrix}"))
850 '("\\end{pmatrix}")) 846 (append '(horiz "\\begin{pmatrix} ")
851 (append '(horiz "\\begin{pmatrix} ") 847 (math-compose-tex-matrix (cdr a) t)
852 (math-compose-tex-matrix (cdr a) t) 848 '(" \\end{pmatrix}")))))
853 '(" \\end{pmatrix}"))))))
854 849
855(put 'latex 'math-var-formatter 'math-compose-tex-var) 850(put 'latex 'math-var-formatter 'math-compose-tex-var)
856 851
@@ -1023,36 +1018,34 @@
1023(put 'eqn 'math-evalto '("evalto " . " -> ")) 1018(put 'eqn 'math-evalto '("evalto " . " -> "))
1024 1019
1025(put 'eqn 'math-matrix-formatter 1020(put 'eqn 'math-matrix-formatter
1026 (function 1021 (lambda (a)
1027 (lambda (a) 1022 (append '(horiz "matrix { ")
1028 (append '(horiz "matrix { ") 1023 (math-compose-eqn-matrix
1029 (math-compose-eqn-matrix 1024 (cdr (math-transpose a)))
1030 (cdr (math-transpose a))) 1025 '("}"))))
1031 '("}")))))
1032 1026
1033(put 'eqn 'math-var-formatter 1027(put 'eqn 'math-var-formatter
1034 (function 1028 (lambda (a prec)
1035 (lambda (a prec) 1029 (let (v)
1036 (let (v) 1030 (if (and math-compose-hash-args
1037 (if (and math-compose-hash-args 1031 (let ((p calc-arg-values))
1038 (let ((p calc-arg-values)) 1032 (setq v 1)
1039 (setq v 1) 1033 (while (and p (not (equal (car p) a)))
1040 (while (and p (not (equal (car p) a))) 1034 (setq p (and (eq math-compose-hash-args t) (cdr p))
1041 (setq p (and (eq math-compose-hash-args t) (cdr p)) 1035 v (1+ v)))
1042 v (1+ v))) 1036 p))
1043 p)) 1037 (if (eq math-compose-hash-args 1)
1044 (if (eq math-compose-hash-args 1) 1038 "#"
1045 "#" 1039 (format "#%d" v))
1046 (format "#%d" v)) 1040 (if (string-match ".'\\'" (symbol-name (nth 2 a)))
1047 (if (string-match ".'\\'" (symbol-name (nth 2 a))) 1041 (math-compose-expr
1048 (math-compose-expr 1042 (list 'calcFunc-Prime
1049 (list 'calcFunc-Prime 1043 (list
1050 (list 1044 'var
1051 'var 1045 (intern (substring (symbol-name (nth 1 a)) 0 -1))
1052 (intern (substring (symbol-name (nth 1 a)) 0 -1)) 1046 (intern (substring (symbol-name (nth 2 a)) 0 -1))))
1053 (intern (substring (symbol-name (nth 2 a)) 0 -1)))) 1047 prec)
1054 prec) 1048 (symbol-name (nth 1 a)))))))
1055 (symbol-name (nth 1 a))))))))
1056 1049
1057(defconst math-eqn-special-funcs 1050(defconst math-eqn-special-funcs
1058 '( calcFunc-log 1051 '( calcFunc-log
@@ -1065,31 +1058,30 @@
1065 calcFunc-arcsinh calcFunc-arccosh calcFunc-arctanh)) 1058 calcFunc-arcsinh calcFunc-arccosh calcFunc-arctanh))
1066 1059
1067(put 'eqn 'math-func-formatter 1060(put 'eqn 'math-func-formatter
1068 (function 1061 (lambda (func a)
1069 (lambda (func a) 1062 (let (left right)
1070 (let (left right) 1063 (if (string-match "[^']'+\\'" func)
1071 (if (string-match "[^']'+\\'" func) 1064 (let ((n (- (length func) (match-beginning 0) 1)))
1072 (let ((n (- (length func) (match-beginning 0) 1))) 1065 (setq func (substring func 0 (- n)))
1073 (setq func (substring func 0 (- n))) 1066 (while (>= (setq n (1- n)) 0)
1074 (while (>= (setq n (1- n)) 0) 1067 (setq func (concat func " prime")))))
1075 (setq func (concat func " prime"))))) 1068 (cond ((or (> (length a) 2)
1076 (cond ((or (> (length a) 2) 1069 (not (math-tex-expr-is-flat (nth 1 a))))
1077 (not (math-tex-expr-is-flat (nth 1 a)))) 1070 (setq left "{left ( "
1078 (setq left "{left ( " 1071 right " right )}"))
1079 right " right )}")) 1072
1080 1073 ((and
1081 ((and 1074 (memq (car a) math-eqn-special-funcs)
1082 (memq (car a) math-eqn-special-funcs) 1075 (= (length a) 2)
1083 (= (length a) 2) 1076 (or (Math-realp (nth 1 a))
1084 (or (Math-realp (nth 1 a)) 1077 (memq (car (nth 1 a)) '(var *))))
1085 (memq (car (nth 1 a)) '(var *)))) 1078 (setq left "~{" right "}"))
1086 (setq left "~{" right "}")) 1079 (t
1087 (t 1080 (setq left " ( "
1088 (setq left " ( " 1081 right " )")))
1089 right " )"))) 1082 (list 'horiz func left
1090 (list 'horiz func left 1083 (math-compose-vector (cdr a) " , " 0)
1091 (math-compose-vector (cdr a) " , " 0) 1084 right))))
1092 right)))))
1093 1085
1094(put 'eqn 'math-lang-read-symbol 1086(put 'eqn 'math-lang-read-symbol
1095 '((?\" 1087 '((?\"
@@ -1111,23 +1103,22 @@
1111 ("above" punc ","))) 1103 ("above" punc ",")))
1112 1104
1113(put 'eqn 'math-lang-adjust-words 1105(put 'eqn 'math-lang-adjust-words
1114 (function 1106 (lambda ()
1115 (lambda () 1107 (let ((code (assoc math-expr-data math-eqn-ignore-words)))
1116 (let ((code (assoc math-expr-data math-eqn-ignore-words))) 1108 (cond ((null code))
1117 (cond ((null code)) 1109 ((null (cdr code))
1118 ((null (cdr code)) 1110 (math-read-token))
1119 (math-read-token)) 1111 ((consp (nth 1 code))
1120 ((consp (nth 1 code)) 1112 (math-read-token)
1121 (math-read-token) 1113 (if (assoc math-expr-data (cdr code))
1122 (if (assoc math-expr-data (cdr code)) 1114 (setq math-expr-data (format "%s %s"
1123 (setq math-expr-data (format "%s %s" 1115 (car code) math-expr-data))))
1124 (car code) math-expr-data)))) 1116 ((eq (nth 1 code) 'punc)
1125 ((eq (nth 1 code) 'punc) 1117 (setq math-exp-token 'punc
1126 (setq math-exp-token 'punc 1118 math-expr-data (nth 2 code)))
1127 math-expr-data (nth 2 code))) 1119 (t
1128 (t 1120 (math-read-token)
1129 (math-read-token) 1121 (math-read-token))))))
1130 (math-read-token)))))))
1131 1122
1132(put 'eqn 'math-lang-read 1123(put 'eqn 'math-lang-read
1133 '((eq (string-match "->\\|<-\\|\\+-\\|\\\\dots\\|~\\|\\^" 1124 '((eq (string-match "->\\|<-\\|\\+-\\|\\\\dots\\|~\\|\\^"
@@ -1357,14 +1348,13 @@
1357 ( calcFunc-in . (math-lang-compose-switch-args "Contains")))) 1348 ( calcFunc-in . (math-lang-compose-switch-args "Contains"))))
1358 1349
1359(put 'yacas 'math-compose-subscr 1350(put 'yacas 'math-compose-subscr
1360 (function 1351 (lambda (a)
1361 (lambda (a) 1352 (let ((args (cdr (cdr a))))
1362 (let ((args (cdr (cdr a)))) 1353 (list 'horiz
1363 (list 'horiz 1354 (math-compose-expr (nth 1 a) 1000)
1364 (math-compose-expr (nth 1 a) 1000) 1355 "["
1365 "[" 1356 (math-compose-vector args ", " 0)
1366 (math-compose-vector args ", " 0) 1357 "]"))))
1367 "]")))))
1368 1358
1369(defun math-yacas-parse-Sum (f _val) 1359(defun math-yacas-parse-Sum (f _val)
1370 "Read in the arguments to \"Sum\" in Calc's Yacas mode." 1360 "Read in the arguments to \"Sum\" in Calc's Yacas mode."
@@ -1600,24 +1590,22 @@
1600(add-to-list 'calc-lang-brackets-are-subscripts 'maxima) 1590(add-to-list 'calc-lang-brackets-are-subscripts 'maxima)
1601 1591
1602(put 'maxima 'math-compose-subscr 1592(put 'maxima 'math-compose-subscr
1603 (function 1593 (lambda (a)
1604 (lambda (a) 1594 (let ((args (cdr (cdr a))))
1605 (let ((args (cdr (cdr a)))) 1595 (list 'horiz
1606 (list 'horiz 1596 (math-compose-expr (nth 1 a) 1000)
1607 (math-compose-expr (nth 1 a) 1000) 1597 "["
1608 "[" 1598 (math-compose-vector args ", " 0)
1609 (math-compose-vector args ", " 0) 1599 "]"))))
1610 "]")))))
1611 1600
1612(put 'maxima 'math-matrix-formatter 1601(put 'maxima 'math-matrix-formatter
1613 (function 1602 (lambda (a)
1614 (lambda (a) 1603 (list 'horiz
1615 (list 'horiz 1604 "matrix("
1616 "matrix(" 1605 (math-compose-vector (cdr a)
1617 (math-compose-vector (cdr a) 1606 (concat math-comp-comma " ")
1618 (concat math-comp-comma " ") 1607 math-comp-vector-prec)
1619 math-comp-vector-prec) 1608 ")")))
1620 ")"))))
1621 1609
1622 1610
1623;;; Giac 1611;;; Giac
@@ -1806,15 +1794,14 @@ order to Calc's."
1806(add-to-list 'calc-lang-allow-underscores 'giac) 1794(add-to-list 'calc-lang-allow-underscores 'giac)
1807 1795
1808(put 'giac 'math-compose-subscr 1796(put 'giac 'math-compose-subscr
1809 (function 1797 (lambda (a)
1810 (lambda (a) 1798 ;; (let ((args (cdr (cdr a))))
1811 ;; (let ((args (cdr (cdr a)))) 1799 (list 'horiz
1812 (list 'horiz 1800 (math-compose-expr (nth 1 a) 1000)
1813 (math-compose-expr (nth 1 a) 1000) 1801 "["
1814 "[" 1802 (math-compose-expr
1815 (math-compose-expr 1803 (calc-normalize (list '- (nth 2 a) 1)) 0)
1816 (calc-normalize (list '- (nth 2 a) 1)) 0) 1804 "]"))) ;;)
1817 "]")))) ;;)
1818 1805
1819(defun math-read-giac-subscr (x _op) 1806(defun math-read-giac-subscr (x _op)
1820 (let ((idx (math-read-expr-level 0))) 1807 (let ((idx (math-read-expr-level 0)))
@@ -1932,7 +1919,7 @@ order to Calc's."
1932(put 'math 'math-function-close "]") 1919(put 'math 'math-function-close "]")
1933 1920
1934(put 'math 'math-radix-formatter 1921(put 'math 'math-radix-formatter
1935 (function (lambda (r s) (format "%d^^%s" r s)))) 1922 (lambda (r s) (format "%d^^%s" r s)))
1936 1923
1937(put 'math 'math-lang-read 1924(put 'math 'math-lang-read
1938 '((eq (string-match "\\[\\[\\|->\\|:>" math-exp-str math-exp-pos) 1925 '((eq (string-match "\\[\\[\\|->\\|:>" math-exp-str math-exp-pos)
@@ -1942,13 +1929,12 @@ order to Calc's."
1942 math-exp-pos (match-end 0)))) 1929 math-exp-pos (match-end 0))))
1943 1930
1944(put 'math 'math-compose-subscr 1931(put 'math 'math-compose-subscr
1945 (function 1932 (lambda (a)
1946 (lambda (a) 1933 (list 'horiz
1947 (list 'horiz 1934 (math-compose-expr (nth 1 a) 1000)
1948 (math-compose-expr (nth 1 a) 1000) 1935 "[["
1949 "[[" 1936 (math-compose-expr (nth 2 a) 0)
1950 (math-compose-expr (nth 2 a) 0) 1937 "]]")))
1951 "]]"))))
1952 1938
1953(defun math-read-math-subscr (x _op) 1939(defun math-read-math-subscr (x _op)
1954 (let ((idx (math-read-expr-level 0))) 1940 (let ((idx (math-read-expr-level 0)))
@@ -2038,26 +2024,24 @@ order to Calc's."
2038(put 'maple 'math-complex-format 'I) 2024(put 'maple 'math-complex-format 'I)
2039 2025
2040(put 'maple 'math-matrix-formatter 2026(put 'maple 'math-matrix-formatter
2041 (function 2027 (lambda (a)
2042 (lambda (a) 2028 (list 'horiz
2043 (list 'horiz 2029 "matrix("
2044 "matrix(" 2030 math-comp-left-bracket
2045 math-comp-left-bracket 2031 (math-compose-vector (cdr a)
2046 (math-compose-vector (cdr a) 2032 (concat math-comp-comma " ")
2047 (concat math-comp-comma " ") 2033 math-comp-vector-prec)
2048 math-comp-vector-prec) 2034 math-comp-right-bracket
2049 math-comp-right-bracket 2035 ")")))
2050 ")"))))
2051 2036
2052(put 'maple 'math-compose-subscr 2037(put 'maple 'math-compose-subscr
2053 (function 2038 (lambda (a)
2054 (lambda (a) 2039 (let ((args (cdr (cdr a))))
2055 (let ((args (cdr (cdr a)))) 2040 (list 'horiz
2056 (list 'horiz 2041 (math-compose-expr (nth 1 a) 1000)
2057 (math-compose-expr (nth 1 a) 1000) 2042 "["
2058 "[" 2043 (math-compose-vector args ", " 0)
2059 (math-compose-vector args ", " 0) 2044 "]"))))
2060 "]")))))
2061 2045
2062(add-to-list 'calc-lang-allow-underscores 'maple) 2046(add-to-list 'calc-lang-allow-underscores 'maple)
2063(add-to-list 'calc-lang-brackets-are-subscripts 'maple) 2047(add-to-list 'calc-lang-brackets-are-subscripts 'maple)
diff --git a/lisp/calc/calc-macs.el b/lisp/calc/calc-macs.el
index 5aaa5f48d6c..06ef3ef0556 100644
--- a/lisp/calc/calc-macs.el
+++ b/lisp/calc/calc-macs.el
@@ -33,12 +33,12 @@
33 33
34 34
35(defmacro calc-wrapper (&rest body) 35(defmacro calc-wrapper (&rest body)
36 `(calc-do (function (lambda () 36 `(calc-do (lambda ()
37 ,@body)))) 37 ,@body)))
38 38
39(defmacro calc-slow-wrapper (&rest body) 39(defmacro calc-slow-wrapper (&rest body)
40 `(calc-do 40 `(calc-do
41 (function (lambda () ,@body)) (point))) 41 (lambda () ,@body) (point)))
42 42
43(defmacro math-showing-full-precision (form) 43(defmacro math-showing-full-precision (form)
44 `(let ((calc-float-format calc-full-float-format)) 44 `(let ((calc-float-format calc-full-float-format))
diff --git a/lisp/calc/calc-map.el b/lisp/calc/calc-map.el
index 0ee82826927..3e2869d146a 100644
--- a/lisp/calc/calc-map.el
+++ b/lisp/calc/calc-map.el
@@ -612,14 +612,13 @@
612 "()") 612 "()")
613 minibuffer-local-map 613 minibuffer-local-map
614 t))) 614 t)))
615 (setq math-arglist (mapcar (function 615 (setq math-arglist (mapcar (lambda (x)
616 (lambda (x) 616 (list 'var
617 (list 'var 617 x
618 x 618 (intern
619 (intern 619 (concat
620 (concat 620 "var-"
621 "var-" 621 (symbol-name x)))))
622 (symbol-name x))))))
623 math-arglist)))) 622 math-arglist))))
624 (setq oper (list "$" 623 (setq oper (list "$"
625 (length math-arglist) 624 (length math-arglist)
@@ -962,12 +961,12 @@
962 (apply 'calcFunc-mapeqp func args))) 961 (apply 'calcFunc-mapeqp func args)))
963 962
964(defun calcFunc-mapeqr (func &rest args) 963(defun calcFunc-mapeqr (func &rest args)
965 (setq args (mapcar (function (lambda (x) 964 (setq args (mapcar (lambda (x)
966 (let ((func (assq (car-safe x) 965 (let ((func (assq (car-safe x)
967 calc-tweak-eqn-table))) 966 calc-tweak-eqn-table)))
968 (if func 967 (if func
969 (cons (nth 1 func) (cdr x)) 968 (cons (nth 1 func) (cdr x))
970 x)))) 969 x)))
971 args)) 970 args))
972 (apply 'calcFunc-mapeqp func args)) 971 (apply 'calcFunc-mapeqp func args))
973 972
@@ -1092,28 +1091,28 @@
1092(defun calcFunc-reducea (func vec) 1091(defun calcFunc-reducea (func vec)
1093 (if (math-matrixp vec) 1092 (if (math-matrixp vec)
1094 (cons 'vec 1093 (cons 'vec
1095 (mapcar (function (lambda (x) (calcFunc-reducer func x))) 1094 (mapcar (lambda (x) (calcFunc-reducer func x))
1096 (cdr vec))) 1095 (cdr vec)))
1097 (calcFunc-reducer func vec))) 1096 (calcFunc-reducer func vec)))
1098 1097
1099(defun calcFunc-rreducea (func vec) 1098(defun calcFunc-rreducea (func vec)
1100 (if (math-matrixp vec) 1099 (if (math-matrixp vec)
1101 (cons 'vec 1100 (cons 'vec
1102 (mapcar (function (lambda (x) (calcFunc-rreducer func x))) 1101 (mapcar (lambda (x) (calcFunc-rreducer func x))
1103 (cdr vec))) 1102 (cdr vec)))
1104 (calcFunc-rreducer func vec))) 1103 (calcFunc-rreducer func vec)))
1105 1104
1106(defun calcFunc-reduced (func vec) 1105(defun calcFunc-reduced (func vec)
1107 (if (math-matrixp vec) 1106 (if (math-matrixp vec)
1108 (cons 'vec 1107 (cons 'vec
1109 (mapcar (function (lambda (x) (calcFunc-reducer func x))) 1108 (mapcar (lambda (x) (calcFunc-reducer func x))
1110 (cdr (math-transpose vec)))) 1109 (cdr (math-transpose vec))))
1111 (calcFunc-reducer func vec))) 1110 (calcFunc-reducer func vec)))
1112 1111
1113(defun calcFunc-rreduced (func vec) 1112(defun calcFunc-rreduced (func vec)
1114 (if (math-matrixp vec) 1113 (if (math-matrixp vec)
1115 (cons 'vec 1114 (cons 'vec
1116 (mapcar (function (lambda (x) (calcFunc-rreducer func x))) 1115 (mapcar (lambda (x) (calcFunc-rreducer func x))
1117 (cdr (math-transpose vec)))) 1116 (cdr (math-transpose vec))))
1118 (calcFunc-rreducer func vec))) 1117 (calcFunc-rreducer func vec)))
1119 1118
@@ -1216,10 +1215,10 @@
1216 (let ((mat nil)) 1215 (let ((mat nil))
1217 (while (setq a (cdr a)) 1216 (while (setq a (cdr a))
1218 (setq mat (cons (cons 'vec 1217 (setq mat (cons (cons 'vec
1219 (mapcar (function (lambda (x) 1218 (mapcar (lambda (x)
1220 (math-build-call func 1219 (math-build-call func
1221 (list (car a) 1220 (list (car a)
1222 x)))) 1221 x)))
1223 (cdr b))) 1222 (cdr b)))
1224 mat))) 1223 mat)))
1225 (math-normalize (cons 'vec (nreverse mat))))) 1224 (math-normalize (cons 'vec (nreverse mat)))))
diff --git a/lisp/calc/calc-misc.el b/lisp/calc/calc-misc.el
index 2db09e2b677..ada754a3979 100644
--- a/lisp/calc/calc-misc.el
+++ b/lisp/calc/calc-misc.el
@@ -176,9 +176,9 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
176 "Create another, independent Calculator buffer." 176 "Create another, independent Calculator buffer."
177 (interactive) 177 (interactive)
178 (if (eq major-mode 'calc-mode) 178 (if (eq major-mode 'calc-mode)
179 (mapc (function 179 (mapc (lambda (v)
180 (lambda (v) 180 (set-default v (symbol-value v)))
181 (set-default v (symbol-value v)))) calc-local-var-list)) 181 calc-local-var-list))
182 (set-buffer (generate-new-buffer "*Calculator*")) 182 (set-buffer (generate-new-buffer "*Calculator*"))
183 (pop-to-buffer (current-buffer)) 183 (pop-to-buffer (current-buffer))
184 (calc-mode)) 184 (calc-mode))
@@ -274,9 +274,8 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
274;;;###autoload 274;;;###autoload
275(defun calc-do-handle-whys () 275(defun calc-do-handle-whys ()
276 (setq calc-why (sort calc-next-why 276 (setq calc-why (sort calc-next-why
277 (function 277 (lambda (x y)
278 (lambda (x y) 278 (and (eq (car x) '*) (not (eq (car y) '*)))))
279 (and (eq (car x) '*) (not (eq (car y) '*))))))
280 calc-next-why nil) 279 calc-next-why nil)
281 (if (and calc-why (or (eq calc-auto-why t) 280 (if (and calc-why (or (eq calc-auto-why t)
282 (and (eq (car (car calc-why)) '*) 281 (and (eq (car (car calc-why)) '*)
diff --git a/lisp/calc/calc-mode.el b/lisp/calc/calc-mode.el
index e109233a825..358854bc93c 100644
--- a/lisp/calc/calc-mode.el
+++ b/lisp/calc/calc-mode.el
@@ -268,7 +268,7 @@
268 (interactive) 268 (interactive)
269 (calc-wrapper 269 (calc-wrapper
270 (let (pos 270 (let (pos
271 (vals (mapcar (function (lambda (v) (symbol-value (car v)))) 271 (vals (mapcar (lambda (v) (symbol-value (car v)))
272 calc-mode-var-list))) 272 calc-mode-var-list)))
273 (unless calc-settings-file 273 (unless calc-settings-file
274 (error "No `calc-settings-file' specified")) 274 (error "No `calc-settings-file' specified"))
diff --git a/lisp/calc/calc-mtx.el b/lisp/calc/calc-mtx.el
index 8deef7dc4fd..bfcd61ddcd4 100644
--- a/lisp/calc/calc-mtx.el
+++ b/lisp/calc/calc-mtx.el
@@ -55,7 +55,7 @@
55(defun math-col-matrix (a) 55(defun math-col-matrix (a)
56 (if (and (Math-vectorp a) 56 (if (and (Math-vectorp a)
57 (not (math-matrixp a))) 57 (not (math-matrixp a)))
58 (cons 'vec (mapcar (function (lambda (x) (list 'vec x))) (cdr a))) 58 (cons 'vec (mapcar (lambda (x) (list 'vec x)) (cdr a)))
59 a)) 59 a))
60 60
61 61
@@ -79,8 +79,8 @@
79 (cons 'vec (nreverse mat)))) 79 (cons 'vec (nreverse mat))))
80 80
81(defun math-mul-mat-vec (a b) 81(defun math-mul-mat-vec (a b)
82 (cons 'vec (mapcar (function (lambda (row) 82 (cons 'vec (mapcar (lambda (row)
83 (math-dot-product row b))) 83 (math-dot-product row b))
84 (cdr a)))) 84 (cdr a))))
85 85
86 86
diff --git a/lisp/calc/calc-poly.el b/lisp/calc/calc-poly.el
index b3f2c96b0ca..5928a8ee47c 100644
--- a/lisp/calc/calc-poly.el
+++ b/lisp/calc/calc-poly.el
@@ -202,7 +202,7 @@
202 (if (memq (car-safe expr) '(+ -)) 202 (if (memq (car-safe expr) '(+ -))
203 (math-list-to-sum 203 (math-list-to-sum
204 (sort (math-sum-to-list expr) 204 (sort (math-sum-to-list expr)
205 (function (lambda (a b) (math-beforep (car a) (car b)))))) 205 (lambda (a b) (math-beforep (car a) (car b)))))
206 expr)) 206 expr))
207 207
208(defun math-list-to-sum (lst) 208(defun math-list-to-sum (lst)
@@ -387,7 +387,7 @@ This returns only the remainder from the pseudo-division."
387 lst 387 lst
388 (if (eq a -1) 388 (if (eq a -1)
389 (math-mul-list lst a) 389 (math-mul-list lst a)
390 (mapcar (function (lambda (x) (math-poly-div-exact x a))) lst)))) 390 (mapcar (lambda (x) (math-poly-div-exact x a)) lst))))
391 391
392(defun math-mul-list (lst a) 392(defun math-mul-list (lst a)
393 (if (eq a 1) 393 (if (eq a 1)
@@ -395,7 +395,7 @@ This returns only the remainder from the pseudo-division."
395 (if (eq a -1) 395 (if (eq a -1)
396 (mapcar 'math-neg lst) 396 (mapcar 'math-neg lst)
397 (and (not (eq a 0)) 397 (and (not (eq a 0))
398 (mapcar (function (lambda (x) (math-mul x a))) lst))))) 398 (mapcar (lambda (x) (math-mul x a)) lst)))))
399 399
400;;; Run GCD on all elements in a list. 400;;; Run GCD on all elements in a list.
401(defun math-poly-gcd-list (lst) 401(defun math-poly-gcd-list (lst)
@@ -502,10 +502,10 @@ Take the base that has the highest degree considering both a and b.
502 502
503(defun math-sort-poly-base-list (lst) 503(defun math-sort-poly-base-list (lst)
504 "Sort a list of polynomial bases." 504 "Sort a list of polynomial bases."
505 (sort lst (function (lambda (a b) 505 (sort lst (lambda (a b)
506 (or (> (nth 1 a) (nth 1 b)) 506 (or (> (nth 1 a) (nth 1 b))
507 (and (= (nth 1 a) (nth 1 b)) 507 (and (= (nth 1 a) (nth 1 b))
508 (math-beforep (car a) (car b)))))))) 508 (math-beforep (car a) (car b)))))))
509 509
510;;; Given an expression find all variables that are polynomial bases. 510;;; Given an expression find all variables that are polynomial bases.
511;;; Return list in the form '( (var1 degree1) (var2 degree2) ... ). 511;;; Return list in the form '( (var1 degree1) (var2 degree2) ... ).
@@ -1033,10 +1033,9 @@ If no partial fraction representation can be found, return nil."
1033 (math-transpose 1033 (math-transpose
1034 (cons 'vec 1034 (cons 'vec
1035 (mapcar 1035 (mapcar
1036 (function 1036 (lambda (x)
1037 (lambda (x) 1037 (cons 'vec (math-padded-polynomial
1038 (cons 'vec (math-padded-polynomial 1038 x var tdeg)))
1039 x var tdeg))))
1040 (cdr eqns)))))) 1039 (cdr eqns))))))
1041 (and (math-vectorp eqns) 1040 (and (math-vectorp eqns)
1042 (let ((res 0) 1041 (let ((res 0)
diff --git a/lisp/calc/calc-prog.el b/lisp/calc/calc-prog.el
index ea9c49748e2..781ba5c8b66 100644
--- a/lisp/calc/calc-prog.el
+++ b/lisp/calc/calc-prog.el
@@ -182,7 +182,7 @@
182 odef key keyname cmd cmd-base cmd-base-default 182 odef key keyname cmd cmd-base cmd-base-default
183 func calc-user-formula-alist is-symb) 183 func calc-user-formula-alist is-symb)
184 (if is-lambda 184 (if is-lambda
185 (setq math-arglist (mapcar (function (lambda (x) (nth 1 x))) 185 (setq math-arglist (mapcar (lambda (x) (nth 1 x))
186 (nreverse (cdr (reverse (cdr form))))) 186 (nreverse (cdr (reverse (cdr form)))))
187 form (nth (1- (length form)) form)) 187 form (nth (1- (length form)) form))
188 (calc-default-formula-arglist form) 188 (calc-default-formula-arglist form)
@@ -290,10 +290,10 @@
290 (y-or-n-p 290 (y-or-n-p
291 "Leave it symbolic for non-constant arguments? "))) 291 "Leave it symbolic for non-constant arguments? ")))
292 (setq calc-user-formula-alist 292 (setq calc-user-formula-alist
293 (mapcar (function (lambda (x) 293 (mapcar (lambda (x)
294 (or (cdr (assq x '((nil . arg-nil) 294 (or (cdr (assq x '((nil . arg-nil)
295 (t . arg-t)))) 295 (t . arg-t))))
296 x))) calc-user-formula-alist)) 296 x)) calc-user-formula-alist))
297 (if cmd 297 (if cmd
298 (progn 298 (progn
299 (require 'calc-macs) 299 (require 'calc-macs)
@@ -319,8 +319,8 @@
319 (append 319 (append
320 (list 'lambda calc-user-formula-alist) 320 (list 'lambda calc-user-formula-alist)
321 (and is-symb 321 (and is-symb
322 (mapcar (function (lambda (v) 322 (mapcar (lambda (v)
323 (list 'math-check-const v t))) 323 (list 'math-check-const v t))
324 calc-user-formula-alist)) 324 calc-user-formula-alist))
325 (list body)))) 325 (list body))))
326 (put func 'calc-user-defn form) 326 (put func 'calc-user-defn form)
diff --git a/lisp/calc/calc-rewr.el b/lisp/calc/calc-rewr.el
index 2cc7b6beef0..1528e12ae0e 100644
--- a/lisp/calc/calc-rewr.el
+++ b/lisp/calc/calc-rewr.el
@@ -181,19 +181,18 @@
181 (calc-line-numbering nil) 181 (calc-line-numbering nil)
182 (calc-show-selections t) 182 (calc-show-selections t)
183 (calc-why nil) 183 (calc-why nil)
184 (math-mt-func (function 184 (math-mt-func (lambda (x)
185 (lambda (x) 185 (let ((result (math-apply-rewrites x (cdr crules)
186 (let ((result (math-apply-rewrites x (cdr crules) 186 heads crules)))
187 heads crules))) 187 (if result
188 (if result 188 (progn
189 (progn 189 (if trace-buffer
190 (if trace-buffer 190 (let ((fmt (math-format-stack-value
191 (let ((fmt (math-format-stack-value 191 (list result nil nil))))
192 (list result nil nil)))) 192 (with-current-buffer trace-buffer
193 (with-current-buffer trace-buffer 193 (insert "\nrewrite to\n" fmt "\n"))))
194 (insert "\nrewrite to\n" fmt "\n")))) 194 (setq heads (math-rewrite-heads result heads t))))
195 (setq heads (math-rewrite-heads result heads t)))) 195 result))))
196 result)))))
197 (if trace-buffer 196 (if trace-buffer
198 (let ((fmt (math-format-stack-value (list math-rewrite-whole-expr nil nil)))) 197 (let ((fmt (math-format-stack-value (list math-rewrite-whole-expr nil nil))))
199 (with-current-buffer trace-buffer 198 (with-current-buffer trace-buffer
@@ -485,8 +484,8 @@
485 (let ((math-rewrite-whole t)) 484 (let ((math-rewrite-whole t))
486 (cdr (math-compile-rewrites (cons 485 (cdr (math-compile-rewrites (cons
487 'vec 486 'vec
488 (mapcar (function (lambda (x) 487 (mapcar (lambda (x)
489 (list 'vec x t))) 488 (list 'vec x t))
490 (if (eq (car-safe pats) 'vec) 489 (if (eq (car-safe pats) 'vec)
491 (cdr pats) 490 (cdr pats)
492 (list pats))))))))) 491 (list pats)))))))))
@@ -656,15 +655,14 @@
656 nil 655 nil
657 (nreverse 656 (nreverse
658 (mapcar 657 (mapcar
659 (function 658 (lambda (v)
660 (lambda (v) 659 (and (car v)
661 (and (car v) 660 (list
662 (list 661 'calcFunc-assign
663 'calcFunc-assign 662 (math-build-var-name
664 (math-build-var-name 663 (car v))
665 (car v)) 664 (math-rwcomp-register-expr
666 (math-rwcomp-register-expr 665 (nth 1 v)))))
667 (nth 1 v))))))
668 math-regs)))) 666 math-regs))))
669 (math-rwcomp-match-vars math-rhs)) 667 (math-rwcomp-match-vars math-rhs))
670 math-remembering) 668 math-remembering)
@@ -672,7 +670,7 @@
672 (let* ((heads (math-rewrite-heads math-pattern)) 670 (let* ((heads (math-rewrite-heads math-pattern))
673 (rule (list (vconcat 671 (rule (list (vconcat
674 (nreverse 672 (nreverse
675 (mapcar (function (lambda (x) (nth 3 x))) 673 (mapcar (lambda (x) (nth 3 x))
676 math-regs))) 674 math-regs)))
677 math-prog 675 math-prog
678 heads 676 heads
@@ -724,10 +722,9 @@
724 (setq rules (cdr rules))) 722 (setq rules (cdr rules)))
725 (if nil-rules 723 (if nil-rules
726 (setq rule-set (cons (cons nil nil-rules) rule-set))) 724 (setq rule-set (cons (cons nil nil-rules) rule-set)))
727 (setq all-heads (mapcar 'car 725 (setq all-heads (mapcar #'car
728 (sort all-heads (function 726 (sort all-heads (lambda (x y)
729 (lambda (x y) 727 (< (cdr x) (cdr y))))))
730 (< (cdr x) (cdr y)))))))
731 (let ((set rule-set) 728 (let ((set rule-set)
732 rule heads ptr) 729 rule heads ptr)
733 (while set 730 (while set
@@ -790,15 +787,14 @@
790 (math-rewrite-heads-rec (car expr))))))) 787 (math-rewrite-heads-rec (car expr)))))))
791 788
792(defun math-parse-schedule (sched) 789(defun math-parse-schedule (sched)
793 (mapcar (function 790 (mapcar (lambda (s)
794 (lambda (s) 791 (if (integerp s)
795 (if (integerp s) 792 s
796 s 793 (if (math-vectorp s)
797 (if (math-vectorp s) 794 (math-parse-schedule (cdr s))
798 (math-parse-schedule (cdr s)) 795 (if (eq (car-safe s) 'var)
799 (if (eq (car-safe s) 'var) 796 (math-var-to-calcFunc s)
800 (math-var-to-calcFunc s) 797 (error "Improper component in rewrite schedule")))))
801 (error "Improper component in rewrite schedule"))))))
802 sched)) 798 sched))
803 799
804(defun math-rwcomp-match-vars (expr) 800(defun math-rwcomp-match-vars (expr)
@@ -1180,9 +1176,8 @@
1180 (list 'calcFunc-register 1176 (list 'calcFunc-register
1181 reg2)))) 1177 reg2))))
1182 (math-rwcomp-pattern (car arg2) (cdr arg2)))) 1178 (math-rwcomp-pattern (car arg2) (cdr arg2))))
1183 (let* ((args (mapcar (function 1179 (let* ((args (mapcar (lambda (x)
1184 (lambda (x) 1180 (cons x (math-rwcomp-best-reg x)))
1185 (cons x (math-rwcomp-best-reg x))))
1186 (cdr expr))) 1181 (cdr expr)))
1187 (args2 (copy-sequence args)) 1182 (args2 (copy-sequence args))
1188 (argp (reverse args2)) 1183 (argp (reverse args2))
diff --git a/lisp/calc/calc-store.el b/lisp/calc/calc-store.el
index a1e385cb406..8f83f34d748 100644
--- a/lisp/calc/calc-store.el
+++ b/lisp/calc/calc-store.el
@@ -168,15 +168,13 @@
168 () 168 ()
169 (setq calc-var-name-map (copy-keymap minibuffer-local-completion-map)) 169 (setq calc-var-name-map (copy-keymap minibuffer-local-completion-map))
170 (define-key calc-var-name-map " " 'self-insert-command) 170 (define-key calc-var-name-map " " 'self-insert-command)
171 (mapc (function 171 (mapc (lambda (x)
172 (lambda (x)
173 (define-key calc-var-name-map (char-to-string x) 172 (define-key calc-var-name-map (char-to-string x)
174 'calcVar-digit))) 173 'calcVar-digit))
175 "0123456789") 174 "0123456789")
176 (mapc (function 175 (mapc (lambda (x)
177 (lambda (x)
178 (define-key calc-var-name-map (char-to-string x) 176 (define-key calc-var-name-map (char-to-string x)
179 'calcVar-oper))) 177 'calcVar-oper))
180 "+-*/^|")) 178 "+-*/^|"))
181 179
182(defvar calc-store-opers) 180(defvar calc-store-opers)
@@ -324,10 +322,9 @@
324 (calc-pop-push-record 322 (calc-pop-push-record
325 (1+ calc-given-value-flag) 323 (1+ calc-given-value-flag)
326 (concat "=" (calc-var-name (car (car var)))) 324 (concat "=" (calc-var-name (car (car var))))
327 (let ((saved-val (mapcar (function 325 (let ((saved-val (mapcar (lambda (v)
328 (lambda (v) 326 (and (boundp (car v))
329 (and (boundp (car v)) 327 (symbol-value (car v))))
330 (symbol-value (car v)))))
331 var))) 328 var)))
332 (unwind-protect 329 (unwind-protect
333 (let ((vv var)) 330 (let ((vv var))
@@ -597,13 +594,12 @@
597 calc-settings-file))) 594 calc-settings-file)))
598 (if var 595 (if var
599 (calc-insert-permanent-variable var) 596 (calc-insert-permanent-variable var)
600 (mapatoms (function 597 (mapatoms (lambda (x)
601 (lambda (x) 598 (and (string-match "\\`var-" (symbol-name x))
602 (and (string-match "\\`var-" (symbol-name x)) 599 (not (memq x calc-dont-insert-variables))
603 (not (memq x calc-dont-insert-variables)) 600 (calc-var-value x)
604 (calc-var-value x) 601 (not (eq (car-safe (symbol-value x)) 'special-const))
605 (not (eq (car-safe (symbol-value x)) 'special-const)) 602 (calc-insert-permanent-variable x)))))
606 (calc-insert-permanent-variable x))))))
607 (save-buffer)))) 603 (save-buffer))))
608 604
609 605
@@ -638,27 +634,26 @@
638(defun calc-insert-variables (buf) 634(defun calc-insert-variables (buf)
639 (interactive "bBuffer in which to save variable values: ") 635 (interactive "bBuffer in which to save variable values: ")
640 (with-current-buffer buf 636 (with-current-buffer buf
641 (mapatoms (function 637 (mapatoms (lambda (x)
642 (lambda (x) 638 (and (string-match "\\`var-" (symbol-name x))
643 (and (string-match "\\`var-" (symbol-name x)) 639 (not (memq x calc-dont-insert-variables))
644 (not (memq x calc-dont-insert-variables)) 640 (calc-var-value x)
645 (calc-var-value x) 641 (not (eq (car-safe (symbol-value x)) 'special-const))
646 (not (eq (car-safe (symbol-value x)) 'special-const)) 642 (or (not (eq x 'var-Decls))
647 (or (not (eq x 'var-Decls)) 643 (not (equal var-Decls '(vec))))
648 (not (equal var-Decls '(vec)))) 644 (or (not (eq x 'var-Holidays))
649 (or (not (eq x 'var-Holidays)) 645 (not (equal var-Holidays '(vec (var sat var-sat)
650 (not (equal var-Holidays '(vec (var sat var-sat) 646 (var sun var-sun)))))
651 (var sun var-sun))))) 647 (insert "(setq "
652 (insert "(setq " 648 (symbol-name x)
653 (symbol-name x) 649 " "
654 " " 650 (prin1-to-string
655 (prin1-to-string 651 (let ((calc-language
656 (let ((calc-language 652 (if (memq calc-language '(nil big))
657 (if (memq calc-language '(nil big)) 653 'flat
658 'flat 654 calc-language)))
659 calc-language))) 655 (math-format-value (symbol-value x) 100000)))
660 (math-format-value (symbol-value x) 100000))) 656 ")\n"))))))
661 ")\n")))))))
662 657
663(defun calc-assign (arg) 658(defun calc-assign (arg)
664 (interactive "P") 659 (interactive "P")
diff --git a/lisp/calc/calc-stuff.el b/lisp/calc/calc-stuff.el
index 58b81faee50..8df2ed905aa 100644
--- a/lisp/calc/calc-stuff.el
+++ b/lisp/calc/calc-stuff.el
@@ -182,7 +182,7 @@ With a prefix, push that prefix as a number onto the stack."
182 math-eval-rules-cache-tag t 182 math-eval-rules-cache-tag t
183 math-format-date-cache nil 183 math-format-date-cache nil
184 math-holidays-cache-tag t) 184 math-holidays-cache-tag t)
185 (mapc (function (lambda (x) (set x -100))) math-cache-list) 185 (mapc (lambda (x) (set x -100)) math-cache-list)
186 (unless inhibit-msg 186 (unless inhibit-msg
187 (message "All internal calculator caches have been reset")))) 187 (message "All internal calculator caches have been reset"))))
188 188
@@ -258,14 +258,14 @@ With a prefix, push that prefix as a number onto the stack."
258 (t (list 'calcFunc-clean a))))) 258 (t (list 'calcFunc-clean a)))))
259 259
260(defun calcFunc-pclean (a &optional prec) 260(defun calcFunc-pclean (a &optional prec)
261 (math-map-over-constants (function (lambda (x) (calcFunc-clean x prec))) 261 (math-map-over-constants (lambda (x) (calcFunc-clean x prec))
262 a)) 262 a))
263 263
264(defun calcFunc-pfloat (a) 264(defun calcFunc-pfloat (a)
265 (math-map-over-constants 'math-float a)) 265 (math-map-over-constants 'math-float a))
266 266
267(defun calcFunc-pfrac (a &optional tol) 267(defun calcFunc-pfrac (a &optional tol)
268 (math-map-over-constants (function (lambda (x) (calcFunc-frac x tol))) 268 (math-map-over-constants (lambda (x) (calcFunc-frac x tol))
269 a)) 269 a))
270 270
271;; The variable math-moc-func is local to math-map-over-constants, 271;; The variable math-moc-func is local to math-map-over-constants,
diff --git a/lisp/calc/calc-units.el b/lisp/calc/calc-units.el
index 709c09ea099..742b2bb8728 100644
--- a/lisp/calc/calc-units.el
+++ b/lisp/calc/calc-units.el
@@ -860,23 +860,22 @@ If COMP or STD is non-nil, put that in the units table instead."
860 tab) 860 tab)
861 (message "Building units table...") 861 (message "Building units table...")
862 (setq math-units-table-buffer-valid nil) 862 (setq math-units-table-buffer-valid nil)
863 (setq tab (mapcar (function 863 (setq tab (mapcar (lambda (x)
864 (lambda (x) 864 (list (car x)
865 (list (car x) 865 (and (nth 1 x)
866 (and (nth 1 x) 866 (if (stringp (nth 1 x))
867 (if (stringp (nth 1 x)) 867 (let ((exp (math-read-plain-expr
868 (let ((exp (math-read-plain-expr 868 (nth 1 x))))
869 (nth 1 x)))) 869 (if (eq (car-safe exp) 'error)
870 (if (eq (car-safe exp) 'error) 870 (error "Format error in definition of %s in units table: %s"
871 (error "Format error in definition of %s in units table: %s" 871 (car x) (nth 2 exp))
872 (car x) (nth 2 exp)) 872 exp))
873 exp)) 873 (nth 1 x)))
874 (nth 1 x))) 874 (nth 2 x)
875 (nth 2 x) 875 (nth 3 x)
876 (nth 3 x) 876 (and (not (nth 1 x))
877 (and (not (nth 1 x)) 877 (list (cons (car x) 1)))
878 (list (cons (car x) 1))) 878 (nth 4 x)))
879 (nth 4 x))))
880 combined-units)) 879 combined-units))
881 (let ((math-units-table tab)) 880 (let ((math-units-table tab))
882 (mapc #'math-find-base-units tab)) 881 (mapc #'math-find-base-units tab))
@@ -1100,10 +1099,9 @@ If COMP or STD is non-nil, put that in the units table instead."
1100 (setq math-decompose-units-cache 1099 (setq math-decompose-units-cache
1101 (cons entry 1100 (cons entry
1102 (sort ulist 1101 (sort ulist
1103 (function 1102 (lambda (x y)
1104 (lambda (x y) 1103 (not (Math-lessp (nth 1 x)
1105 (not (Math-lessp (nth 1 x) 1104 (nth 1 y)))))))))
1106 (nth 1 y))))))))))
1107 (cdr math-decompose-units-cache)))) 1105 (cdr math-decompose-units-cache))))
1108 1106
1109(defun math-decompose-unit-part (unit) 1107(defun math-decompose-unit-part (unit)
diff --git a/lisp/calc/calc-vec.el b/lisp/calc/calc-vec.el
index 875414595cf..036f08e276d 100644
--- a/lisp/calc/calc-vec.el
+++ b/lisp/calc/calc-vec.el
@@ -744,7 +744,7 @@
744;;; Get the Nth row of a matrix. 744;;; Get the Nth row of a matrix.
745(defun calcFunc-mrow (mat n) ; [Public] 745(defun calcFunc-mrow (mat n) ; [Public]
746 (if (Math-vectorp n) 746 (if (Math-vectorp n)
747 (math-map-vec (function (lambda (x) (calcFunc-mrow mat x))) n) 747 (math-map-vec (lambda (x) (calcFunc-mrow mat x)) n)
748 (if (and (eq (car-safe n) 'intv) (math-constp n)) 748 (if (and (eq (car-safe n) 'intv) (math-constp n))
749 (calcFunc-subvec mat 749 (calcFunc-subvec mat
750 (math-add (nth 2 n) (if (memq (nth 1 n) '(2 3)) 0 1)) 750 (math-add (nth 2 n) (if (memq (nth 1 n) '(2 3)) 0 1))
@@ -768,15 +768,15 @@
768 768
769;;; Get the Nth column of a matrix. 769;;; Get the Nth column of a matrix.
770(defun math-mat-col (mat n) 770(defun math-mat-col (mat n)
771 (cons 'vec (mapcar (function (lambda (x) (elt x n))) (cdr mat)))) 771 (cons 'vec (mapcar (lambda (x) (elt x n)) (cdr mat))))
772 772
773(defun calcFunc-mcol (mat n) ; [Public] 773(defun calcFunc-mcol (mat n) ; [Public]
774 (if (Math-vectorp n) 774 (if (Math-vectorp n)
775 (calcFunc-trn 775 (calcFunc-trn
776 (math-map-vec (function (lambda (x) (calcFunc-mcol mat x))) n)) 776 (math-map-vec (lambda (x) (calcFunc-mcol mat x)) n))
777 (if (and (eq (car-safe n) 'intv) (math-constp n)) 777 (if (and (eq (car-safe n) 'intv) (math-constp n))
778 (if (math-matrixp mat) 778 (if (math-matrixp mat)
779 (math-map-vec (function (lambda (x) (calcFunc-mrow x n))) mat) 779 (math-map-vec (lambda (x) (calcFunc-mrow x n)) mat)
780 (calcFunc-mrow mat n)) 780 (calcFunc-mrow mat n))
781 (or (and (integerp (setq n (math-check-integer n))) 781 (or (and (integerp (setq n (math-check-integer n)))
782 (> n 0)) 782 (> n 0))
@@ -804,7 +804,7 @@
804 804
805;;; Remove the Nth column from a matrix. 805;;; Remove the Nth column from a matrix.
806(defun math-mat-less-col (mat n) 806(defun math-mat-less-col (mat n)
807 (cons 'vec (mapcar (function (lambda (x) (math-mat-less-row x n))) 807 (cons 'vec (mapcar (lambda (x) (math-mat-less-row x n))
808 (cdr mat)))) 808 (cdr mat))))
809 809
810(defun calcFunc-mrcol (mat n) ; [Public] 810(defun calcFunc-mrcol (mat n) ; [Public]
@@ -939,10 +939,10 @@
939 (calcFunc-idn a (1- (length m))) 939 (calcFunc-idn a (1- (length m)))
940 (if (math-vectorp m) 940 (if (math-vectorp m)
941 (if (math-zerop a) 941 (if (math-zerop a)
942 (cons 'vec (mapcar (function (lambda (x) 942 (cons 'vec (mapcar (lambda (x)
943 (if (math-vectorp x) 943 (if (math-vectorp x)
944 (math-mimic-ident a x) 944 (math-mimic-ident a x)
945 a))) 945 a))
946 (cdr m))) 946 (cdr m)))
947 (math-dimension-error)) 947 (math-dimension-error))
948 (calcFunc-idn a)))) 948 (calcFunc-idn a))))
diff --git a/lisp/calc/calc-yank.el b/lisp/calc/calc-yank.el
index e03c00243c4..6186df718db 100644
--- a/lisp/calc/calc-yank.el
+++ b/lisp/calc/calc-yank.el
@@ -643,12 +643,11 @@ Interactively, reads the register using `register-read-with-preview'."
643 (allow-ret (> n 1)) 643 (allow-ret (> n 1))
644 (list (math-showing-full-precision 644 (list (math-showing-full-precision
645 (mapcar (if (> n 1) 645 (mapcar (if (> n 1)
646 (function (lambda (x) 646 (lambda (x)
647 (math-format-flat-expr x 0))) 647 (math-format-flat-expr x 0))
648 (function 648 (lambda (x)
649 (lambda (x) 649 (if (math-vectorp x) (setq allow-ret t))
650 (if (math-vectorp x) (setq allow-ret t)) 650 (math-format-nice-expr x (frame-width))))
651 (math-format-nice-expr x (frame-width)))))
652 (if (> n 0) 651 (if (> n 0)
653 (calc-top-list n) 652 (calc-top-list n)
654 (calc-top-list 1 (- n))))))) 653 (calc-top-list 1 (- n)))))))
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index 5716189b342..9d869f359bc 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -506,7 +506,7 @@ The variable VAR will be added to `calc-mode-var-list'."
506 506
507(defun calc-mode-var-list-restore-default-values () 507(defun calc-mode-var-list-restore-default-values ()
508 "Restore the default values of the variables in `calc-mode-var-list'." 508 "Restore the default values of the variables in `calc-mode-var-list'."
509 (mapcar (function (lambda (v) (set (car v) (nth 1 v)))) 509 (mapcar (lambda (v) (set (car v) (nth 1 v)))
510 calc-mode-var-list)) 510 calc-mode-var-list))
511 511
512(defun calc-mode-var-list-restore-saved-values () 512(defun calc-mode-var-list-restore-saved-values ()
@@ -535,7 +535,7 @@ The variable VAR will be added to `calc-mode-var-list'."
535 newvarlist))) 535 newvarlist)))
536 (setq varlist (cdr varlist))))))) 536 (setq varlist (cdr varlist)))))))
537 (if newvarlist 537 (if newvarlist
538 (mapcar (function (lambda (v) (set (car v) (nth 1 v)))) 538 (mapcar (lambda (v) (set (car v) (nth 1 v)))
539 newvarlist) 539 newvarlist)
540 (calc-mode-var-list-restore-default-values)))) 540 (calc-mode-var-list-restore-default-values))))
541 541
@@ -1315,8 +1315,9 @@ Notations: 3.14e6 3.14 * 10^6
1315\\{calc-mode-map} 1315\\{calc-mode-map}
1316" 1316"
1317 (interactive) 1317 (interactive)
1318 (mapc (function ;FIXME: Why (set-default v (symbol-value v)) ?!?!? 1318 (mapc (lambda (v)
1319 (lambda (v) (set-default v (symbol-value v)))) 1319 ;; FIXME: Why (set-default v (symbol-value v)) ?!?!?
1320 (set-default v (symbol-value v)))
1320 calc-local-var-list) 1321 calc-local-var-list)
1321 (kill-all-local-variables) 1322 (kill-all-local-variables)
1322 (use-local-map (if (eq calc-algebraic-mode 'total) 1323 (use-local-map (if (eq calc-algebraic-mode 'total)
@@ -1537,7 +1538,7 @@ See `window-dedicated-p' for what that means."
1537 (let ((tail (nthcdr (1- calc-undo-length) calc-undo-list))) 1538 (let ((tail (nthcdr (1- calc-undo-length) calc-undo-list)))
1538 (if tail (setcdr tail nil))) 1539 (if tail (setcdr tail nil)))
1539 (setq calc-redo-list nil)))) 1540 (setq calc-redo-list nil))))
1540 (mapc (function (lambda (v) (set-default v (symbol-value v)))) 1541 (mapc (lambda (v) (set-default v (symbol-value v)))
1541 calc-local-var-list) 1542 calc-local-var-list)
1542 (let ((buf (current-buffer)) 1543 (let ((buf (current-buffer))
1543 (win (get-buffer-window (current-buffer))) 1544 (win (get-buffer-window (current-buffer)))
diff --git a/lisp/calc/calccomp.el b/lisp/calc/calccomp.el
index 1f3ae842638..e4f6e989ecf 100644
--- a/lisp/calc/calccomp.el
+++ b/lisp/calc/calccomp.el
@@ -464,14 +464,13 @@
464 (math-compose-vector (cdr (nth 1 a)) 464 (math-compose-vector (cdr (nth 1 a))
465 (math-vector-to-string sep nil) 465 (math-vector-to-string sep nil)
466 (or cprec prec)) 466 (or cprec prec))
467 (cons 'horiz (mapcar (function 467 (cons 'horiz (mapcar (lambda (x)
468 (lambda (x) 468 (if (eq (car-safe x) 'calcFunc-bstring)
469 (if (eq (car-safe x) 'calcFunc-bstring) 469 (prog1
470 (prog1 470 (math-compose-expr
471 (math-compose-expr 471 x (or bprec cprec prec))
472 x (or bprec cprec prec)) 472 (setq bprec -123))
473 (setq bprec -123)) 473 (math-compose-expr x (or cprec prec))))
474 (math-compose-expr x (or cprec prec)))))
475 (cdr (nth 1 a))))))) 474 (cdr (nth 1 a)))))))
476 ((and (memq (car a) '(calcFunc-cvert calcFunc-clvert calcFunc-crvert)) 475 ((and (memq (car a) '(calcFunc-cvert calcFunc-clvert calcFunc-crvert))
477 (not (eq calc-language 'unform)) 476 (not (eq calc-language 'unform))
@@ -482,47 +481,46 @@
482 (let* ((base 0) 481 (let* ((base 0)
483 (v 0) 482 (v 0)
484 (prec (or (nth 2 a) prec)) 483 (prec (or (nth 2 a) prec))
485 (c (mapcar (function 484 (c (mapcar (lambda (x)
486 (lambda (x) 485 (let ((b nil) (cc nil) a d)
487 (let ((b nil) (cc nil) a d) 486 (if (and (memq (car-safe x) '(calcFunc-cbase
488 (if (and (memq (car-safe x) '(calcFunc-cbase 487 calcFunc-ctbase
489 calcFunc-ctbase 488 calcFunc-cbbase))
490 calcFunc-cbbase)) 489 (memq (length x) '(1 2)))
491 (memq (length x) '(1 2))) 490 (setq b (car x)
492 (setq b (car x) 491 x (nth 1 x)))
493 x (nth 1 x))) 492 (if (and (eq (car-safe x) 'calcFunc-crule)
494 (if (and (eq (car-safe x) 'calcFunc-crule) 493 (memq (length x) '(1 2))
495 (memq (length x) '(1 2)) 494 (or (null (nth 1 x))
496 (or (null (nth 1 x)) 495 (and (math-vectorp (nth 1 x))
497 (and (math-vectorp (nth 1 x)) 496 (= (length (nth 1 x)) 2)
498 (= (length (nth 1 x)) 2) 497 (math-vector-is-string
499 (math-vector-is-string 498 (nth 1 x)))
500 (nth 1 x))) 499 (and (natnump (nth 1 x))
501 (and (natnump (nth 1 x)) 500 (<= (nth 1 x) 255))))
502 (<= (nth 1 x) 255)))) 501 (setq cc (list
503 (setq cc (list 502 'rule
504 'rule 503 (if (math-vectorp (nth 1 x))
505 (if (math-vectorp (nth 1 x)) 504 (aref (math-vector-to-string
506 (aref (math-vector-to-string 505 (nth 1 x) nil) 0)
507 (nth 1 x) nil) 0) 506 (or (nth 1 x) ?-))))
508 (or (nth 1 x) ?-)))) 507 (or (and (memq (car-safe x) '(calcFunc-cvspace
509 (or (and (memq (car-safe x) '(calcFunc-cvspace 508 calcFunc-ctspace
510 calcFunc-ctspace 509 calcFunc-cbspace))
511 calcFunc-cbspace)) 510 (memq (length x) '(2 3))
512 (memq (length x) '(2 3)) 511 (eq (nth 1 x) 0))
513 (eq (nth 1 x) 0)) 512 (null x)
514 (null x) 513 (setq cc (math-compose-expr x prec))))
515 (setq cc (math-compose-expr x prec)))) 514 (setq a (if cc (math-comp-ascent cc) 0)
516 (setq a (if cc (math-comp-ascent cc) 0) 515 d (if cc (math-comp-descent cc) 0))
517 d (if cc (math-comp-descent cc) 0)) 516 (if (eq b 'calcFunc-cbase)
518 (if (eq b 'calcFunc-cbase) 517 (setq base (+ v a -1))
519 (setq base (+ v a -1)) 518 (if (eq b 'calcFunc-ctbase)
520 (if (eq b 'calcFunc-ctbase) 519 (setq base v)
521 (setq base v) 520 (if (eq b 'calcFunc-cbbase)
522 (if (eq b 'calcFunc-cbbase) 521 (setq base (+ v a d -1)))))
523 (setq base (+ v a d -1))))) 522 (setq v (+ v a d))
524 (setq v (+ v a d)) 523 cc))
525 cc)))
526 (cdr (nth 1 a))))) 524 (cdr (nth 1 a)))))
527 (setq c (delq nil c)) 525 (setq c (delq nil c))
528 (if c 526 (if c
@@ -865,16 +863,15 @@
865 (while (<= (setq col (1+ col)) cols) 863 (while (<= (setq col (1+ col)) cols)
866 (setq res (cons (cons math-comp-just 864 (setq res (cons (cons math-comp-just
867 (cons base 865 (cons base
868 (mapcar (function 866 (mapcar (lambda (r)
869 (lambda (r) 867 (list 'horiz
870 (list 'horiz 868 (math-compose-expr
871 (math-compose-expr 869 (nth col r)
872 (nth col r) 870 math-comp-vector-prec)
873 math-comp-vector-prec) 871 (if (= col cols)
874 (if (= col cols) 872 ""
875 "" 873 (concat
876 (concat 874 math-comp-comma-spc " "))))
877 math-comp-comma-spc " ")))))
878 a))) 875 a)))
879 res))) 876 res)))
880 (nreverse res))) 877 (nreverse res)))
@@ -923,7 +920,7 @@
923 ( ?\^? . "\\^?" ))) 920 ( ?\^? . "\\^?" )))
924 921
925(defun math-vector-to-string (a &optional quoted) 922(defun math-vector-to-string (a &optional quoted)
926 (setq a (concat (mapcar (function (lambda (x) (if (consp x) (nth 1 x) x))) 923 (setq a (concat (mapcar (lambda (x) (if (consp x) (nth 1 x) x))
927 (cdr a)))) 924 (cdr a))))
928 (if (string-match "[\000-\037\177\\\"]" a) 925 (if (string-match "[\000-\037\177\\\"]" a)
929 (let ((p 0) 926 (let ((p 0)