Call Function Begin Rule

When the state is "call_function_begin", then copy the function parameters to the Parameters list.

if the following are true:

  • expression state at time t = "call_function_begin"
  • the expression at time t = function call with name: name and arguments: args
  • there is a function named name with parameters params at line line

then Parameters List at time (t + 1) = params

Python copies the function parameters so that it can create the "Function Variables" map where the keys are the parameters and values are the argument values. When Python is executing statements in the function body, the "Function Variables" map becomes the "Variables" map.

For example,

if the following are true:

  • expression state at time 10 = "call_function_begin"
  • the expression at time 10 = add_three(a)
  • there is a function named "add_three" with parameters [ x, [ ] ] at line 0

then Parameters List at time (10 + 1) = [ x, [ ] ]

Try stepping through the simulator to see LW Python copy function parameters to "Parameters."

Code Editor
LW Python State
Current Line1Current Tab0Time0
LW Python Simulator

Comments

Please log in to add comments