Documentation ¶
Index ¶
- Variables
- func EnvKeys(m *Env) []string
- func EvalExprs(exprs []Sexpr, e *Env, doPrint bool) error
- func IsBalanced(tokens []Token) (bool, error)
- func LexParseEval(s string, e *Env) error
- func LexRepr(i Token) string
- func LoadFile(e *Env, filename string) error
- func LongDocStr(e *Env) (string, error)
- func ReadLine() (string, error)
- func ShortDocStr(e *Env) (string, error)
- type Atom
- type Builtin
- type ConsCell
- type Env
- type Number
- func (n Number) Add(o Number) Number
- func (n Number) Div(o Number) Number
- func (n Number) Equal(o Sexpr) bool
- func (n Number) Greater(o Number) bool
- func (n Number) GreaterEqual(o Number) bool
- func (n Number) Less(o Number) bool
- func (n Number) LessEqual(o Number) bool
- func (n Number) Mul(o Number) Number
- func (n Number) Neg() Number
- func (n Number) Rem(o Number) Number
- func (n Number) String() string
- func (n Number) Sub(o Number) Number
- type Sexpr
- type Token
Constants ¶
This section is empty.
Variables ¶
var RawCore string
var Version string = "v0.0.57"
Functions ¶
func IsBalanced ¶
IsBalanced returns true iff parens are balanced
func LexParseEval ¶
LexParseEval lexes, parses, and evaluates the given string.
func LongDocStr ¶
LongDocStr returns a long, Markdown docstr for a function, macro or special form.
func ShortDocStr ¶
ShortDocStr returns an abbreviated explanation of all functions, macros and special forms.
Types ¶
type Atom ¶
type Atom struct {
// contains filtered or unexported fields
}
Atom is the primitive symbolic type.
True is the generic truthy item. Everything but Nil is true. See also Nil in cons.go.
type Builtin ¶
type Builtin struct { Name string Fn func([]Sexpr, *Env) (Sexpr, error) // Fn must take at least this many arguments: FixedArity int // If true, fn can take more arguments: NAry bool Doc *ConsCell Args *ConsCell Examples *ConsCell }
Builtin represents a function with a native (Go) implementation.
type ConsCell ¶
type ConsCell struct {
// contains filtered or unexported fields
}
ConsCell is a cons cell. Use Cons to create one.
Nil is the empty list / cons cell. Cons with Nil to create a list of one item.
type Env ¶
type Env struct {
// contains filtered or unexported fields
}
Env stores a local environment, possibly pointing to a caller's environment.
func InitGlobals ¶
func InitGlobals() Env
func (*Env) SetTopLevel ¶
SetTopLevel sets the value of a symbol in the top-level environment.
type Number ¶
type Number struct {
// contains filtered or unexported fields
}
Number wraps a big.Int (for now)
func Num ¶
func Num(ob interface{}) Number
Num is a `num` constructor, which can take a string or a ("normal") number.
func (Number) GreaterEqual ¶
GreaterEqual returns true if the first number is >= the second.