Function: calc-store-map

calc-store-map is an autoloaded, interactive and byte-compiled function defined in calc-store.el.gz.

Signature

(calc-store-map &optional OPER VAR)

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-store.el.gz
(defun calc-store-map (&optional oper var)
  (interactive)
  (calc-wrapper
   (let* ((calc-dollar-values (mapcar #'calc-get-stack-element
				      (nthcdr calc-stack-top calc-stack)))
	  (calc-dollar-used 0)
	  (oper (or oper (calc-get-operator "Store Mapping")))
	  (nargs (car oper)))
     (or var (setq var (calc-read-var-name (format "Store Mapping %s: "
						   (nth 2 oper)))))
     (if var
	 (let ((old (calc-var-value var)))
	   (if (eq (car-safe old) 'special-const)
	       (error "\"%s\" is a special constant" (calc-var-name var)))
	   (if (not old)
               (if (memq var '(var-inf var-uinf var-nan))
                   (error "\"%s\" is a special variable" (calc-var-name var))
                 (error "No such variable: \"%s\"" (calc-var-name var))))
           (let ((calc-simplify-mode (if (eq calc-simplify-mode 'none)
                                         'num calc-simplify-mode))
                 (values (and (> nargs 1)
                              (calc-top-list (1- nargs) (1+ calc-dollar-used)))))
             (message "Working...")
             (calc-set-command-flag 'clear-message)
             (if (stringp old)
                 (setq old (math-read-expr old)))
             (if (eq (car-safe old) 'error)
                 (error "Bad format in variable contents: %s" (nth 2 old)))
             (setq values (if (calc-is-inverse)
                              (append values (list old))
                            (append (list old) values)))
             (calc-store-value var
                               (calc-normalize (cons (nth 1 oper) values))
                               (nth 2 oper)
                               (+ calc-dollar-used (1- nargs)))
             (message "Variable \"%s\" changed" (calc-var-name var))))))))