Function: math-vector-to-string

math-vector-to-string is an autoloaded and byte-compiled function defined in calccomp.el.gz.

Signature

(math-vector-to-string A &optional QUOTED)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calccomp.el.gz
(defun math-vector-to-string (a &optional quoted)
  (setq a (concat (mapcar (lambda (x) (if (consp x) (nth 1 x) x))
			  (cdr a))))
  (if (string-match "[\000-\037\177\\\"]" a)
      (let ((p 0)
	    (pat (if quoted "[\000-\037\177\\\"]" "[\000-\037\177]"))
	    (codes (if quoted math-vector-to-string-chars '((?\^? . "^?"))))
	    (fmt (if quoted "\\^%c" "^%c"))
	    new)
	(while (setq p (string-match pat a p))
	  (if (setq new (assq (aref a p) codes))
	      (setq a (concat (substring a 0 p)
			      (cdr new)
			      (substring a (1+ p)))
		    p (+ p (length (cdr new))))
	    (setq a (concat (substring a 0 p)
			    (format fmt (+ (aref a p) 64))
			    (substring a (1+ p)))
		  p (+ p 2))))))
  (if quoted
      (concat "\"" a "\"")
    a))