r()
What does r() do?
r() reverses the array or string inside of it. For example, "Hello" becomes "olleH".
from ArrayExpressions import arrex
lst = [1, 2, 3, 4, 5]
output = arrex.evaluate(lst, "r(x)")
print(output) # [5, 4, 3, 2, 1]Other Important Information:
| Input | Any array or string |
|---|---|
| Does it create a new scope? | No |
| Output | A reversed array/string |
| K | None |
| I | Same from previous scope |
| Example | i0(r(x)) |
| Example Explanation | This returns the last element of x (the base array). Same as doing i{L-1}(x) |