eK()
What does ek() do?
eK() loops through every K element(s) as an array. e1() allows you work with each element while e2() allows you to work with pairs of elements.
from ArrayExpressions import arrex
lst = [1, 2, 3, 4, 5]
output = arrex.evaluate(lst, "e(x + 1)")
print(output) # [2, 3, 4, 5, 6]
Other Important Information:
Input | Any valid ArrEx code that returns a value |
---|---|
Does it create a new scope? | Yes |
Output | An array of all the values calculated |
K | Any number, optional, defaulting to 1 |
I | The iteration number/what element is being looked at. Starts at 0 |
Example | e1(x == 5 ? x : N) |
Example Explanation | This creates an array of every element that equals 5 and Null for everything else. |