Skip to content

Latest commit

 

History

History
133 lines (84 loc) · 2.04 KB

bool.md

File metadata and controls

133 lines (84 loc) · 2.04 KB

bool

Boolean operations

Overview

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

Index

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

Operations

and

and

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

false

Places false on the stack

Macro definition:

def false /false

Example:

Input Stack
false false

not

not

Negates x.

Stack effects:

( x:Bool -- Bool )

Example:

Input Stack
true not false
not true

or

or

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

true

Places true on the stack

Macro definition:

def true /true

Example:

Input Stack
true true