Boolean operations
A Bool
is a value that is either true or false.
An item on the stack can be parsed as a boolean if it is equal to true
or false
when all characters are converted to lowercase. Operations
are defined for true
and false
that simply return that string.
Example:
Input | Stack |
---|---|
true true and |
true |
'FALSE' and |
false |
Operation | Description |
---|---|
and |
And operation |
and |
Logical conjunction, boolean |
false |
False |
not |
Not operation |
not |
Negation, boolean |
or |
Or operation |
or |
Logical disjunction, boolean |
true |
True |
The logical conjunction of x and y.
Stack effects:
( x:Bool y:Bool -- Bool )
Example:
Input | Stack |
---|---|
c true true and |
true |
c true false and |
false |
c false false and |
false |
Places false
on the stack
Macro definition:
def false /false
Example:
Input | Stack |
---|---|
false |
false |
Negates x.
Stack effects:
( x:Bool -- Bool )
Example:
Input | Stack |
---|---|
true not |
false |
not |
true |
The logical disjunction of x and y.
Stack effects:
( x:Bool y:Bool -- Bool )
Example:
Input | Stack |
---|---|
c true true or |
true |
c true false or |
true |
c false false or |
false |
Places true
on the stack
Macro definition:
def true /true
Example:
Input | Stack |
---|---|
true |
true |