www.delorie.com/gnu/docs/calc/calc_141.html | search |
Buy the book! | |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The K (calc-keep-args
) command acts like a prefix for
the following command. It prevents that command from removing its
arguments from the stack. For example, after 2 RET 3 +,
the stack contains the sole number 5, but after 2 RET 3 K +,
the stack contains the arguments and the result: `2 3 5'.
This works for all commands that take arguments off the stack. As another example, K a s simplifies a formula, pushing the simplified version of the formula onto the stack after the original formula (rather than replacing the original formula).
Note that you could get the same effect by typing RET a s, copying the formula and then simplifying the copy. One difference is that for a very large formula the time taken to format the intermediate copy in RET a s could be noticeable; K a s would avoid this extra work.
Even stack manipulation commands are affected. TAB works by popping two values and pushing them back in the opposite order, so 2 RET 3 K TAB produces `2 3 3 2'.
A few Calc commands provide other ways of doing the same thing. For example, ' sin($) replaces the number on the stack with its sine using algebraic entry; to push the sine and keep the original argument you could use either ' sin($1) or K ' sin($). See section 4.5 Algebraic Entry. Also, the s s command is effectively the same as K s t. See section 13.1 Storing Variables.
Keyboard macros may interact surprisingly with the K prefix. If you have defined a keyboard macro to be, say, `Q +' to add one number to the square root of another, then typing K X will execute K Q +, probably not what you expected. The K prefix will apply to just the first command in the macro rather than the whole macro.
If you execute a command and then decide you really wanted to keep
the argument, you can press M-RET (calc-last-args
).
This command pushes the last arguments that were popped by any command
onto the stack. Note that the order of things on the stack will be
different than with K: 2 RET 3 + M-RET leaves
`5 2 3' on the stack instead of `2 3 5'. See section 4.8 Undoing Mistakes.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
webmaster | delorie software privacy |
Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |