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:

InputAny valid ArrEx code that returns a value
Does it create a new scope?Yes
OutputAn array of all the values calculated
KAny number, optional, defaulting to 1
IThe iteration number/what element is being looked at. Starts at 0
Examplee1(x == 5 ? x : N)
Example ExplanationThis creates an array of every element that equals 5 and Null for everything else.

Custom Functions

oK()