EVAL/SCOPED

Graduated feature: scoped_dictionary

Takes the topmost item and evaluates it as a PumpkinScript program on the current stack with a clone of the dictionary

Input stack: code

Output stack: result of code evaluation

EVAL/SCOPED is a sister version of EVAL with one important distinction: all new instructions defined inside (or updated values for previously defined ones) within this evaluation (using SET and DEF) will be gone after the evaluation.

PumpkinDB> 1 'val SET [2 'val SET val] EVAL/SCOPED val
2 1

Allocation

Allocates a copy of the code (this might change in the future) during the runtime.

Errors

EmptyStack error if there is less than one item on the stack

Tests

eval_scoped_clone : "scoped_dictionary" FEATURE? [1 'val SET [2 'val SET val] EVAL/SCOPED val 2 WRAP 2 1 2 WRAP EQUAL?] [1] IFELSE.

results matching ""

    No results matching ""