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

GNU Emacs Calc 2.02 Manual

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

18.5.6 Calling Calc from Your Lisp Programs

A later section (see section 18.5.7 Calculator Internals) gives a full description of Calc's internal Lisp functions. It's not hard to call Calc from inside your programs, but the number of these functions can be daunting. So Calc provides one special "programmer-friendly" function called calc-eval that can be made to do just about everything you need. It's not as fast as the low-level Calc functions, but it's much simpler to use!

It may seem that calc-eval itself has a daunting number of options, but they all stem from one simple operation.

In its simplest manifestation, `(calc-eval "1+2")' parses the string "1+2" as if it were a Calc algebraic entry and returns the result formatted as a string: "3".

Since calc-eval is on the list of recommended autoload functions, you don't need to make any special preparations to load Calc before calling calc-eval the first time. Calc will be loaded and initialized for you.

All the Calc modes that are currently in effect will be used when evaluating the expression and formatting the result.


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