Command: eval

NEST HelpDesk Command Index NEST Quick Reference

Name:
 eval - evaluate a string of SLI code
Synopsis:
 string eval -> obj1 ... objn

Description:
Reads a string and evaluates its content. The resulting objects are
pushed onto the stack.

As in regular batch mode the interpreter reads tokens from a 
stream, a string stream in this case,  and immediately executes the 
incoming language constructs.

An alternative implementation is cvx exec. Here cvx calls cst to
first create an array of token from the string which is then converted
to a procedure.

The function evalstring uses cvx and executs the procedure in a 
separate stopped context using the standard error handler.

A similar function to eval also occurs in Python.

Examples:
 
 (1 2 add) eval              --> 3
 ([1 2 3] /peter 5 def) eval --> [1 2 3]

Author:
 Jochen M. Eppler
FirstVersion:
 June 2013
SeeAlso:cvx exec cst evalstring token
Source:
 /home/abuild/rpmbuild/BUILD/nest-2.4.1/lib/sli/typeinit.sli

NEST HelpDesk Command Index NEST Quick Reference

© 2000-2010 The NEST Initiative