Credit to Ferdinand Jamitzky for the hack that makes this possible.
Currently there are 194 operators. That is too many to list in great detail when I'd rather add more. Please read the code.
If you want to see the function for one and can't use an IDE to go to the code definition, you can use .help()
on the operator and it will return its function, and for some it will return more help (which i am also slowly working on)
Operators defined with OpTwo take in two inputs input_one % operator % input_two
and can use <<
, >>
, |
, %
, and @
.
All operators can take in inputs as a function. Simply call Z.pwr([1, 2, 3], [4, 5, 6])
or N.types(["string", 1, 2, [54, 32, 10]])
to call it just as if you used it as an operator.
>>> [4, 5, 6, 8] | Z.pwr | [2, 4, 3, 2]
[16, 625, 216, 64]
>>> 4 ** 2
16
>>> 5 ** 4
625
>>> 6 ** 3
216
>>> 8 ** 2
64
Operators defined with Op take in one input input % operator
or operator % input
and can use <<
, >>
, <
, >
, |
, %
, and @
.
>>> [1, 2, 3, ["5", 5]] % N.types
[<class 'int'>, <class 'int'>, <class 'int'>, <class 'list'>]
>>> type(1)
<class 'int'>
>>> type(2)
<class 'int'>
>>> type(3)
<class 'int'>
>>> type(["5", 5])
<class 'list'>