call
Input Stack:
|
⇨ | Output Stack:
|
Pop a list off the stack and execute it as an ASL program. This allows for dynamic program execution where the program itself can be constructed or stored in variables and then executed on demand.
Parameters¶
- program: A list containing ASL expressions to execute
Examples¶
Basic program execution:
(,a,),:call
Pos | Input | Output |
---|---|---|
0 | List(a) | a |
This takes the list (a)
and executes it as a program, pushing a
onto the stack.
Executing a program to square the top stack item:
Before | After |
name,sps,:eq, :sum | name,sps,:eq, :sum, (,:dup, :mul, ),:call |
This executes the program (,:dup,:mul,)
which duplicates the top stack item and then
multiplies the two copies together, effectively squaring the value. The program transforms
the sum result by squaring it.
Related Operations¶
- :fcall - Function call operator
- :each - Execute a function for each element in a list (uses call internally)
- :map - Apply a function to each element in a list
- :list - Create lists that can be executed with call
- :get - Retrieve stored programs from variables
- :set - Store programs in variables for later execution