Documentation ¶
Index ¶
- Constants
- Variables
- func Gcd(a, b int) int
- func NewLexer(input io.Reader, sourcename string) *myLex
- type Atom
- type CompoundTerm
- type Number
- func (n Number) Ceil() Number
- func (n Number) ChSign() Number
- func (n Number) Clone() Term
- func (n Number) CloneNsp(nsp int) Term
- func (n Number) Eq(t Term) bool
- func (n Number) Floor() Number
- func (n Number) Greater(r Number) bool
- func (n Number) IsInteger() bool
- func (n Number) IsNaN() bool
- func (n Number) IsZero() bool
- func (n Number) Less(r Number) bool
- func (n Number) Minus(r Number) Number
- func (n Number) Normalize() Number
- func (n Number) Plus(r Number) Number
- func (n Number) Pretty() string
- func (n Number) String() string
- func (n Number) Times(r Number) Number
- func (n Number) ToInt() int
- type String
- type Term
- type Underscore
- type Variable
Constants ¶
View Source
const ( RED = "\x1b[31m" GREEN = "\x1b[32m" BLUE = "\x1b[34m" YELLOW = "\x1b[33m" CYAN = "\x1b[36m" RESET = "\x1b[0m" )
View Source
const ATOM = 57348
View Source
const LEXERROR = 57352
View Source
const NUMBER = 57350
View Source
const OPQUERY = 57347
View Source
const OPRULE = 57346
View Source
const STRING = 57349
View Source
const VARIABLE = 57351
View Source
const VERSION = "0.8.6"
Variables ¶
View Source
var ( // Not a Number, normalized. NaN = Number{ Num: 1, Den: 0, Normalized: true, } // Min Number value MinNumber = Number{ Num: int(math.MinInt64) + 1, Den: 1, Normalized: true, } // Max Number value MaxNumber = Number{ Num: int(math.MaxInt64), Den: 1, Normalized: true, } ZeroNumber = Number{ Num: 0, Den: 1, Normalized: true, } OneNumber = Number{ Num: 1, Den: 1, Normalized: true, } )
View Source
var (
FLOATFORMAT = "%.2f"
)
Functions ¶
Types ¶
type CompoundTerm ¶
a compound term is a Term with children. A compound term withoutout children remains a compound term, different from an Atom.
func (CompoundTerm) Clone ¶
func (t CompoundTerm) Clone() Term
func (CompoundTerm) CloneNsp ¶
func (t CompoundTerm) CloneNsp(nsp int) Term
CloneNsp implements Term.
func (CompoundTerm) String ¶
func (c CompoundTerm) String() string
type Number ¶
Number are immutable Number can silently overflow, when exceeding int64 capacity.
func (Number) Ceil ¶
Return the smallest integer Number that is greater or equal to n. n can be negative or positive.
func (Number) Eq ¶
Check if the provided Term is a Number and is Equal to n. No unification, no variable, no underscore accepted here.
func (Number) Floor ¶
Return the largest integer Number that is less or equal to n. n can be negative or positive.
func (Number) Normalize ¶
Normalize the internal representation of a number. 0/0 is normalized as 0/1.
type Term ¶
type Term interface { String() string // String() is the string representation of the entire term // Strings are neither quoted nor escaped internally, they are stored without the start/end " or ` Pretty() string // Pretty() is the string representation of the term, pretty printing lists and rules and queries. Clone() Term // Clone() returns a deep copy of the term CloneNsp(nsp int) Term // CloneNsp() returns a deep copy of the term with a new name space }
func MustParseString ¶
type Underscore ¶
type Underscore struct{}
func (Underscore) String ¶
func (u Underscore) String() string
Click to show internal directories.
Click to hide internal directories.