Documentation ¶
Overview ¶
Package slang (short for Sabre lang) provides a tiny LISP dialect built using factilities provided by Sabre. See New() for initializing Slang and using it.
Index ¶
- func Add(args ...float64) float64
- func BindAll(scope sabre.Scope) error
- func Case(scope sabre.Scope, args []sabre.Value) (sabre.Value, error)
- func Divide(first float64, args ...float64) float64
- func Gt(base float64, args ...float64) bool
- func GtE(base float64, args ...float64) bool
- func Implements(v interface{}, t sabre.Type) (bool, error)
- func Lt(base float64, args ...float64) bool
- func LtE(base float64, args ...float64) bool
- func MacroExpand(scope sabre.Scope, f sabre.Value) (sabre.Value, error)
- func MakeString(vals ...sabre.Value) sabre.Value
- func Multiply(args ...float64) float64
- func Printf(format string, args ...interface{}) error
- func Println(args ...interface{}) error
- func Realize(seq sabre.Seq) *sabre.List
- func Sub(x float64, args ...float64) float64
- func ThreadFirst(scope sabre.Scope, args []sabre.Value) (sabre.Value, error)
- func ThreadLast(scope sabre.Scope, args []sabre.Value) (sabre.Value, error)
- func Throw(scope sabre.Scope, args ...sabre.Value) error
- func ToType(val sabre.Value, to sabre.Type) (sabre.Value, error)
- func TypeOf(v interface{}) sabre.Value
- type Slang
- func (slang *Slang) Bind(symbol string, v sabre.Value) error
- func (slang *Slang) BindGo(symbol string, v interface{}) error
- func (slang *Slang) CurrentNS() string
- func (slang *Slang) Eval(v sabre.Value) (sabre.Value, error)
- func (slang *Slang) Parent() sabre.Scope
- func (slang *Slang) ReadEval(r io.Reader) (sabre.Value, error)
- func (slang *Slang) ReadEvalStr(src string) (sabre.Value, error)
- func (slang *Slang) Resolve(symbol string) (sabre.Value, error)
- func (slang *Slang) SwitchNS(sym sabre.Symbol) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Implements ¶
Implements checks if given value implements the interface represented by 't'. Returns error if 't' does not represent an interface type.
func MacroExpand ¶ added in v0.4.0
MacroExpand is a wrapper around the sabre MacroExpand function that ignores the expanded bool flag.
func MakeString ¶
MakeString returns stringified version of all args.
func Println ¶
func Println(args ...interface{}) error
Println is an alias for fmt.Println which ignores the return values.
func Realize ¶
Realize realizes a sequence by continuously calling First() and Next() until the sequence becomes nil.
func ThreadFirst ¶
ThreadFirst threads the expressions through forms by inserting result of eval as first argument to next expr.
func ThreadLast ¶
ThreadLast threads the expressions through forms by inserting result of eval as last argument to next expr.
Types ¶
type Slang ¶
type Slang struct {
// contains filtered or unexported fields
}
Slang represents an instance of slang interpreter.
func (*Slang) Bind ¶
Bind binds the given name to the given Value into the slang interpreter context.
func (*Slang) BindGo ¶
BindGo is similar to Bind but handles conversion of Go value 'v' to sabre Value type.
func (*Slang) ReadEval ¶
ReadEval reads from the given reader and evaluates all the forms obtained in Slang context.
func (*Slang) ReadEvalStr ¶
ReadEvalStr reads the source and evaluates it in Slang context.