Comparisions
Operation | Description |
---|---|
eq |
Equal |
gt |
Greater than |
gte |
Greater than or equal |
lt |
Less than |
lte |
Less than or equal |
neq |
Not equal |
sort |
Sort stack |
sort/t |
Sort stack as text, text sort |
Returns true if x and y are equal.
Stack effects:
( x:Int y:Int -- Bool )
( x:Dec y:Dec -- Bool )
( x:Float/v y:Float/v -- Bool )
( x:Rat y:Rat -- Bool )
( x:Complex y:Complex -- Bool )
( x:Text y:Text -- Bool )
Example:
Input | Stack |
---|---|
c 5 5 eq |
true |
c 4 5 eq |
false |
Returns true if x is greater than y.
Stack effects:
( x:Int y:Int -- Bool )
( x:Dec y:Dec -- Bool )
( x:Float/v y:Float/v -- Bool )
( x:Rat y:Rat -- Bool )
( x:Text y:Text -- Bool )
Example:
Input | Stack |
---|---|
c 6 5 gt |
true |
c 5 5 gt |
false |
c 4 5 gt |
false |
Returns true if x is greater than or equal to y.
Stack effects:
( x:Int y:Int -- Bool )
( x:Dec y:Dec -- Bool )
( x:Float/v y:Float/v -- Bool )
( x:Rat y:Rat -- Bool )
( x:Text y:Text -- Bool )
Example:
Input | Stack |
---|---|
c 6 5 gte |
true |
c 5 5 gte |
true |
c 4 5 gte |
false |
Returns true if x is less than y.
Stack effects:
( x:Int y:Int -- Bool )
( x:Dec y:Dec -- Bool )
( x:Float/v y:Float/v -- Bool )
( x:Rat y:Rat -- Bool )
( x:Text y:Text -- Bool )
Example:
Input | Stack |
---|---|
c 6 5 lt |
false |
c 5 5 lt |
false |
c 4 5 lt |
true |
Returns true if x is less than or equal to y.
Stack effects:
( x:Int y:Int -- Bool )
( x:Dec y:Dec -- Bool )
( x:Float/v y:Float/v -- Bool )
( x:Rat y:Rat -- Bool )
( x:Text y:Text -- Bool )
Example:
Input | Stack |
---|---|
c 6 5 lte |
false |
c 5 5 lte |
true |
c 4 5 lte |
true |
Returns true if x and y are not equal.
Stack effects:
( x:Int y:Int -- Bool )
( x:Dec y:Dec -- Bool )
( x:Float/v y:Float/v -- Bool )
( x:Rat y:Rat -- Bool )
( x:Complex y:Complex -- Bool )
( x:Text y:Text -- Bool )
Example:
Input | Stack |
---|---|
c 5 5 neq |
false |
c 4 5 neq |
true |
Sorts all items on the stack in ascending order. The entire stack must be of a similar type or able to be converted to a similar type. If no numeric common type can be found, items are sorted as text.
Stack effects:
( Dec* -- Dec* )
( Int* -- Int* )
( Rat* -- Rat* )
( Float/v* -- Float/v* )
( Text* -- Text* )
Example:
Input | Stack |
---|---|
c 4 2.5 1.75 sort |
1.75 | 2.5 | 4 |
c 4 5/2 1.75 sort |
1 3/4 | 2 1/2 | 4 |
c 4 5/2 'one and three quarters' sort |
4 | 5/2 | one and three quarters |
Sorts the stack by their values as text.
Stack effects:
( Text* -- Text* )
Example:
Input | Stack |
---|---|
01.1 2 003 sort/t |
003 | 01.1 | 2 |