Function: calculator-funcall

calculator-funcall is a byte-compiled function defined in calculator.el.gz.

Signature

(calculator-funcall F &optional X Y)

Documentation

If F is a symbol, evaluate (F X Y).

Otherwise, it should be a list, evaluate it with X, Y bound to the arguments.

Source Code

;; Defined in /usr/src/emacs/lisp/calculator.el.gz
(defun calculator-funcall (f &optional X Y)
  "If F is a symbol, evaluate (F X Y).
Otherwise, it should be a list, evaluate it with X, Y bound to the
arguments."
  ;; remember binary ops for calculator-repR/L
  (when Y (setq calculator-last-opXY (list f X Y)))
  (if (symbolp f)
    (cond ((and X Y) (funcall f X Y))
          (X         (funcall f X))
          (t         (funcall f)))
    ;; f is an expression
    (let ((TX (and X (calculator-truncate X)))
          (TY (and Y (calculator-truncate Y)))
          (DX (if (and X calculator-deg) (degrees-to-radians X) X))
          (L  calculator-saved-list)
          (fF `(calculator-funcall ',f x y))
          (fD '(if calculator-deg (radians-to-degrees x) x)))
      (eval `(cl-flet ((F (&optional x y) ,fF) (D (x) ,fD))
               (let ((X ,X) (Y ,Y) (DX ,DX) (TX ,TX) (TY ,TY) (L ',L))
                 ,f))
            t))))