manual:chapter6:operators:cmd_ovr_eval1

This is an old revision of the document!



Synopsis


Evaluate an object, single pass

Stack Diagram


Input Stack Output Stack
O1 see list under Description
Level 1 Level n Level 1

Legend

Type Operator
Parallel list processing Yes, but specific group is determined by the object being evaluated
Affected by flags -70 Global autosimplification rules
-71 Application of Group 1 autosimplification rules
-72 Application of Group 2 autosimplification rules
-73 Application of Group 3 autosimplification rules
-74 Application of Group 4 autosimplification rules
-75 Application of Group 5 autosimplification rules
-76 Application of Group 6 autosimplification rules
-77 Application of Group 7 autosimplification rules
-78 Application of Group 8 autosimplification rules
-103 Complex results

Description


The EVAL1 command evaluates the object on the top level of the stack.

The effect of the evaluation and the resulting output depends on the type of object being evaluated, as summarized by the following list.

  • Local Name: EVAL1 recalls the content of the variable.
  • Global Name: EVAL1 calls the content of a variable:
    1. a Name is evaluated;
    2. a Program is evaluated;
    3. a Directory becomes the current directory;
    4. other objects which are not lists are put on the stack.
  • Program: EVAL1 enters each object in the program:
    1. an unquoted Name is evaluated;
    2. a Keyword is XEQted;
    3. other objects which are not lists are put on the stack.
  • Symbolic expression: EVAL1 enters each object in the expression:
    1. a Name is evaluated;
    2. a Keyword is XEQted;
    3. other objects which are not lists are put on the stack.
  • Other objects: if they are not lists EVAL1 puts them on the stack.
  • List: EVAL1 enters each object in the list:
    1. any object is evaluated according above mentioned rules.

As a final step, EVAL1 will perform numerical simplification according to the status of flags from -70 to -78. If the final results

The main difference from EVAL is that EVAL1 performs only one step of the process described above, allowing evaluation of recursive formulas that would otherwise yield a Circular reference error.

Compatibility


This command is new in newRPL and does not exist in userRPL.

Usage


If the following command is executed

2:                         'X+1'
1:                           'X'
……………………………………………………………………………………
STO

then the command

1:                           'X'
……………………………………………………………………………………
EVAL

would return a Circular reference error.

Instead

1:                           'X'
……………………………………………………………………………………
EVAL1

will result in

1:                         'X+1'
……………………………………………………………………………………

and further use of EVAL1 will return 'X+2', 'X+3', et cetera.

Related Commands


Overloadable operators 26 3 NEW

Operator Short Description
Evaluation operators:
EVAL1 Evaluate one level NEW
EVAL Evaluate full depth
XEQ Execute NEW
→NUM Compute numeric result
Test operators:
== Equality test
Not equal test
< Less than test
Less than or equal test
> Greater than test
Greater than or equal test
CMP Comparison test (<0 if A<B, 0 if A==B, >0 if A>B) NEW
SAME Comparison test, true if objects are the same
ISTRUE True test NEW
Logical operators:
AND Logical AND
OR Logical OR
XOR Logical XOR
NOT Logical NOT
Mathematic operators:
+ Addition
- Subtraction
* Multiplication
/ Division
^ Power
XROOT Root
INV Inverse
NEG Negate/change sign
ABS Magnitude or absolute value
  • manual/chapter6/operators/cmd_ovr_eval1.1572308098.txt.gz
  • Last modified: 2019/10/28 17:14
  • by jojo1973