www.delorie.com/gnu/docs/calc/calc_350.html   search  
 
Buy the book!


GNU Emacs Calc 2.02 Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

18.5.6.7 Variable Values

Variables in the formula passed to calc-eval are not normally replaced by their values. If you wish this, you can use the evalv function (see section 11.2 Algebraic Manipulation). For example, if 4 is stored in Calc variable a (i.e., in Lisp variable var-a), then `(calc-eval "a+pi")' will return the formula "a + pi", but `(calc-eval "evalv(a+pi)")' will return "7.14159265359".

To store in a Calc variable, just use setq to store in the corresponding Lisp variable. (This is obtained by prepending `var-' to the Calc variable name.) Calc routines will understand either string or raw form values stored in variables, although raw data objects are much more efficient. For example, to increment the Calc variable a:

 
(setq var-a (calc-eval "evalv(a+1)" 'raw))

 

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003