UNWRAP

Takes the topmost item and evaluates it as a PumpkinScript values-only program on the current stack

Input stack: vals

Output stack: all the values

UNWRAP is a "safe" cousin of EVAL. It takes a closure and as long as it does not contain any instructions, evaluates it (essentially, putting all the data on the stack)

It's particularly useful in conjunction with NONE? and SOME?.

PumpkinDB> [1 2 3] UNWRAP
1 2 3

Allocation

Runtime allocation during parsing

Errors

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

InvalidValue error if there are instructions in the item

Tests

works : [3 2 1 ] UNWRAP.
empty_stack : [UNWRAP] TRY UNWRAP 0x04 EQUAL?.

results matching ""

    No results matching ""