sc()
What does sc() do?
sc() allows you to set what x is at any level. It changes the scope.
from ArrayExpressions import arrex
lst = [1, 2, 3, 4, 5]
output = arrex.evaluate(lst, 'sc("Hello", i0())')
print(output) # "H"
Other Important Information:
Input | Any array before the comma and any valid ArrEx code that returns a value after the comma |
---|---|
Does it create a new scope? | Yes |
Output | Will output the second parameter with x being the first parameter. |
K | None |
I | Same as scope from before |
Example | sc(ar(1, 2, 3), e1(x+1)) |
Example Explanation | It will output [2, 3, 4] no matter what x was supplied because x is changed from sc(). |