eval

eval --  evaluates an argument.

Syntax

eval (s_exp)

		

Arguments

s_exp

Any Gamma or Lisp expression.

Returns

The result of evaluating the argument. Note that the argument is also evaluated as part of the function calling mechanism.

Description

The eval function forms the basis for running a Gamma program. Every data type has a defined behavior to the eval call. These are:

The eval function can be useful when constructing code which must be conditionally executed at a later date, and passed about as data until that time. It may be useful to provide a piece of code as an argument to a generic function so that the function can evaluate it as part of its operation.

Example

Note

Note: The # operator is used to protect an expression from evaluation. See Quote Operators for more information.

    Gamma> a = 5;
    5
    Gamma> b = #a;
    a
    Gamma> b;
    a
    Gamma> eval(b);
    5
    Gamma> 
    		

See the Callback Functions section of the Photon Functioins chapter (Tutorial One) in the Cogent Tools Demo and Tutorials book for an example of this function used in context.

See Also

eval_list

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.