next up previous

12.3.5 Evaluating a Function within a String

The eval function evaluates the string as though it were entered at the command prompt.

Syntax

(eval  <string-or-symbol-expression>)

where the only argument is the command, constant, or global variable to be executed. NOTE: eval does not permit the use of local variables (except when the local variables are defined as part of the command such as with an instance query function), nor will it evaluate any of the construct definition forms (i.e., defrule, deffacts, etc.). The return value is the result of the evaluation of the string (or FALSE if an error occurs).

The eval function is not available for binary-load only or runtime CLIPS configurations (see the Advanced Programming Guide).

Example

CLIPS> (eval "(+ 3 4)")
7
CLIPS> (eval "(create$ a b c)")
(a b c)
CLIPS>


next up previous