The functions described here perform various operations on the Calc stack and trail. They are to be used in interactive Calc commands.
The stack elements are pushed without any sub-formula selections.
You can give an optional third argument to this function, which must
be a list the same size as vals of selections. Each selection
must be eq
to some sub-formula of the corresponding formula
in vals, or nil
if that formula should have no selection.
If any stack elements contain selections, and selections have not
been disabled by the j e (calc-enable-selections
) command,
this function returns the selected portions rather than the entire
stack elements. It can be given a third "selection-mode" argument
which selects other behaviors. If it is the symbol t
, then
a selection in any of the requested stack elements produces an
"illegal operation on selections" error. If it is the symbol full
,
the whole stack entry is always returned regardless of selections.
If it is the symbol sel
, the selected portion is always returned,
or nil
if there is no selection. (This mode ignores the j e
command.) If the symbol is entry
, the complete stack entry in
list form is returned; the first element of this list will be the whole
formula, and the third element will be the selection (or nil
).
calc-top-list
. The return
value of calc-pop-stack
is uninteresting.
If there are any selected sub-formulas among the popped elements, and
j e has not been used to disable selections, this produces an
error without changing the stack. If you supply an optional third
argument of t
, the stack elements are popped even if they
contain selections.
calc-top-list
, except that it calls
calc-normalize
on the values that it takes from the stack. They
are also passed through check-complete
, so that incomplete
objects will be rejected with an error message. All computational
commands should use this in preference to calc-top-list
; the only
standard Calc commands that operate on the stack without normalizing
are stack management commands like calc-enter
and calc-roll-up
.
This function accepts the same optional selection-mode argument as
calc-top-list
.
calc-top-list-n
in which only
a single element of the stack is taken and returned, rather than a list
of elements. This also accepts an optional selection-mode argument.
nil
, the normalized objects are also recorded in the trail.
A typical stack-based computational command would take the form,
(calc-enter-result n tag (cons 'calcFunc-func (calc-top-list-n n)))
If any of the n stack elements replaced contain sub-formula
selections, and selections have not been disabled by j e,
this function takes one of two courses of action. If n is
equal to the number of elements in vals, then each element of
vals is spliced into the corresponding selection; this is what
happens when you use the TAB key, or when you use a unary
arithmetic operation like sqrt
. If vals has only one
element but n is greater than one, there must be only one
selection among the top n stack elements; the element from
vals is spliced into that selection. This is what happens when
you use a binary arithmetic operation like +. Any other
combination of n and vals is an error when selections
are present.
nil
, this uses calc-enter-result
as outlined above. Otherwise, it maps the function over several stack
elements; 数値接頭引数(Numeric Prefix Arguments) 参照 . For example,
(defun calc-zeta (arg) (interactive "P") (calc-unary-op "zeta" 'calcFunc-zeta arg))
calc-unary-op
. The optional ident and unary
arguments specify the behavior when the prefix argument is zero or
one, respectively. If the prefix is zero, the value ident
is pushed onto the stack, if specified, otherwise an error message
is displayed. If the prefix is one, the unary function unary
is applied to the top stack element, or, if unary is not
specified, nothing happens. When the argument is two or more,
the binary function func is reduced across the top arg
stack elements; when the argument is negative, the function is
mapped between the next-to-top -arg stack elements and the
top element.
*Calculator*
buffer and reformat its contents from memory.
This must be called after changing any parameter, such as the current
display radix, which might change the appearance of existing stack
entries. (During a keyboard macro invoked by the X key, refreshing
is suppressed, but a flag is set so that the entire stack will be refreshed
rather than just the top few elements when the macro finishes.)
Go to the first, previous, next, last section, table of contents.
利用度数