This page serves as an incomplete list of all the operators ever. It lists, in no particular order, operators, their syntax in RPN and Infix, their type expression, and of course, what they serve to do.
Adding operators
You are free to add new operators at will.
Multiple operators may be assigned to the same symbol, but it is recommended that when creating a new operator, one attempts to use a thus far unused operation. Symbols should preferably not be alphanumeric for any languages, and may be multiple characters long.
A note on types
Types in this article are written in pseudo-Haskell, as Haskell is god.
The operators
Arithmetic
Symbol(s) |
Type |
RPN |
Infix |
Name |
Function |
Example |
Output
|
+
|
Num x, Num y, Num z => x -> y -> z
|
x y +
|
x+y
|
ADD
|
Obtain the sum of x and y
|
5+2.3
|
7.3
|
-
|
Num x, Num y, Num z => x -> y -> z
|
x y -
|
x-y
|
SUB or SUBTRACT
|
Obtain the difference of x and y
|
5-2
|
3
|
* , ×
|
Num x, Num y, Num z => x -> y -> z
|
x y *
|
x*y
|
MULT or MULTIPLY
|
Obtain the product of two numbers
|
2*3
|
6
|
/ , ÷
|
Num x, Num y, Num z => x -> y -> z
|
x y /
|
x/y
|
DIV or DIVIDE
|
Obtain the quotient of x divided by y
|
6/2
|
3
|
%
|
Num x, Num y, Num z => x -> y -> z
|
x y %
|
x%u
|
MOD or MODULUS
|
Obtain the remainder of dividing x by y
|
9%2
|
1
|
** , ^
|
Num x, Num y, Num z => x -> y -> z
|
x y **
|
x**y
|
POW or EXP or EXPONENT
|
Raise x to the power of y
|
2**8
|
256
|
√
|
Num x, Num y => x -> y
|
x √
|
√x
|
SQRT
|
Calculate the square root of a number
|
√256
|
8
|
∛
|
Num x, Num y => x -> y
|
x ∛
|
∛x
|
CBRT
|
Calculate the cube root of a number
|
∛512
|
8
|
∜
|
Num x, Num y => x -> y
|
x ∜
|
∜x
|
TSRT
|
Calculate the fourth root of a number
|
∜256
|
4
|
√
|
Num x, Num y, Num z => x -> y -> z
|
x y √
|
x√y
|
ROOT
|
Calculate an arbitrary root of a number
|
2√256
|
8
|
⍟
|
Num x, Num y => x -> y
|
x ⍟
|
⍟x
|
NATLOG
|
Calculate the natural logarithm of a number
|
⍟1000
|
6.907...
|
⍟
|
Num x, Num y, Num z => x -> y -> z
|
x y ⍟
|
x⍟y
|
LOG or LOGARITHM
|
Calculate the power that a number must be raised to to produce another number
|
3⍟81
|
3
|
‰
|
Num w, Num x, Num y, Num z => w -> x -> y -> z
|
x y z ‰
|
x‰y,z
|
EXPMOD or EXPONENTIAL MODULUS
|
Calculate a number to a power modulus another number (an operation more efficient than calculating a number to a power then calculating the result of that modulus a number, and it doesn't force you to define extra space)
|
2‰16,12
|
4
|
n ↑ s
|
Num x, Num y, Num z => x -> y -> z
|
x y <arrows> or x y z ↑
|
x<arrows>
|
Knuth's Up Arrow Notation/Hyperoperations
|
Use the n-2th hyperoperation on arguments x and y; may have an additional argument z representing the value of n in RPN
|
3↑3
|
3**(3**3)=7625597484987
|
Conversions
Symbol(s) |
Type |
RPN |
Infix |
Name |
Function |
Example |
Output
|
?
|
Boolable a => a -> Bool
|
x ?
|
x?
|
BOOLEANIZE
|
Test an arbitrary value for truthiness: Return TRUE if it evaluates to true and FALSE if it evaluates to false
|
5?
|
TRUE
|
Boolean Logic
Symbol(s) |
Type |
RPN |
Infix |
Name |
Function |
Example |
Output
|
Relational Operators
Symbol(s) |
Type |
RPN |
Infix |
Name |
Function |
Example |
Output
|
Bitwise
A "binable" is something that can be represented as a string of bits. canbe_BIN:t
means a bitable specifically of type t. Note that any bitwise operator, unless otherwise noted or obviously impossible, may work in one of two ways: Either starting at the highest "1" bit of its greatest argument and working down from there or working on a fixed-width word. Examples here use the former method.
A number in square brackets after a type means something of a specific number of bits in width.
Symbol(s) |
Type |
RPN |
Infix |
Name |
Function |
Example |
Output
|
! or ~
|
Binable x => x -> x
|
x !
|
!x
|
Bitwise NOT
|
NOT each bit of an integer or other binable.
|
~5
|
-6
|
&
|
Binable x => x -> x -> x
|
x y &
|
x&y
|
Bitwise AND
|
AND each pair of bits in two integers or other binables.
|
5&3
|
1
|
|
|
Binable x => x -> x -> x
|
x y |
|
x|y
|
Bitwise OR
|
OR each pair of bits in two integers or other binables
|
5|3
|
7
|
^
|
Binable x => x -> x -> x
|
x y ^
|
x^y
|
Bitwise XOR
|
XOR each pair of bits in two integers or other binables
|
5^3
|
6
|
!& , ~&
|
Binable x => x -> x -> x
|
x y !&
|
x!&y
|
Bitwise NAND
|
NAND each pair of bits in two integers or other binables
|
5!&3
|
-2
|
!| , ~|
|
Binable x => x -> x -> x
|
x y !|
|
x!|y
|
Bitwise NOR
|
NOR each pair of bits in two integers or other binables
|
5!|3
|
-8
|
!^ , ~^
|
Binable x => x -> x -> x
|
x y !^
|
x!^y
|
Bitwise XNOR
|
XNOR each pair of bits in two integers or other binables
|
5!^3
|
-7
|
$
|
Binable x => x -> x -> x or Binable x => x -> x -> y
|
x y $
|
x$y
|
MINGLE
|
Alternate the bits of the first and second argument (first[0], second[0], first[1], second[1]...). Results in a number of twice the width. Alternatively, returns a tuple split down the middle of two integers of the same width as its argument.
|
3$2=112$102
|
11102=14
|
& or &:
|
Binable x => x -> x or Binable x => x -> y
|
x &:
|
&:x
|
Unary AND
|
AND each pair of bits in the number, e.g. the first and second, then the third and fourth, et cetera. Results in a number of half bitwidth. Can only operate on fixed-width values.
|
&:11=&:10112
|
1=012
|
| or |:
|
Binable x => x -> x or Binable x => x -> y
|
x |:
|
|:x
|
Unary OR
|
OR each pair of bits in the number, e.g. the first and second, then the third and fourth, et cetera. Results in a number of half bitwidth. Can only operate on fixed-width values.
|
|:11=|:10112
|
3=112
|
^ or ^:
|
Binable x => x -> x or Binable x => x -> y
|
x ^:
|
^:x
|
Unary XOR
|
XOR each pair of bits in the number, e.g. the first and second, then the third and fourth, et cetera. Results in a number of half bitwidth. Can only operate on fixed-width values.
|
^:11=^:10112
|
2=102
|
~
|
Binable x => x -> x -> x or Binable x => x -> x-> y
|
x y ~
|
x~y
|
SELECT
|
??? (fill this out)
|
12~5=11002~1012
|
2=102
|
Tritwise
Symbol(s) |
Type |
RPN |
Infix |
Name |
Function |
Example |
Output
|
Logical
Symbol(s) |
Type |
RPN |
Infix |
Name |
Function |
Example |
Output
|
Container Membership
Symbol(s) |
Type |
RPN |
Infix |
Name |
Function |
Example |
Output
|
List Comprehension
Symbol(s) |
Type |
RPN |
Infix |
Name |
Function |
Example |
Output
|
!!
|
[a] -> Int -> a
|
x y !!
|
x!!y
|
ITEM
|
Get an item from list x by index y
|
[1, 2, 3]!!0
|
1
|