Function: math-rwcomp-optional-arg

math-rwcomp-optional-arg is a byte-compiled function defined in calc-rewr.el.gz.

Signature

(math-rwcomp-optional-arg HEAD ARGP)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-rewr.el.gz
(defun math-rwcomp-optional-arg (head argp)
  (let ((arg (car argp)))
    (if (eq (car-safe arg) 'calcFunc-opt)
	(and (memq (length arg) '(2 3))
	     (progn
	       (or (eq (car-safe (nth 1 arg)) 'var)
		   (error "First argument of opt( ) must be a variable"))
	       (setcar argp (nth 1 arg))
	       (if (= (length arg) 2)
		   (or (get head 'math-rewrite-default)
		       (error "opt( ) must include a default in this context"))
		 (nth 2 arg))))
      (and (eq (car-safe arg) 'neg)
	   (let* ((part (list (nth 1 arg)))
		  (partp (math-rwcomp-optional-arg head part)))
	     (and partp
		  (setcar argp (math-rwcomp-neg (car part)))
		  (math-neg partp)))))))