Package ds/any/runtime represents the Scheme library (ds any runtime).
This package represents the Scheme library (ds any runtime)
binary.go doc.go ds_any_runtime.go error.go eval.go export.go global.go hash.go keyword.go kind.go lambda.go list.go number.go param.go proc.go string.go symbol.go types.go unsafe.go values.go vector.go
const ( TypeCodeAny = iota TypeCodeType // go:Type TypeCodeNull // go:Null s:null? -- Evaler interface TypeCodePair // go:Pair s:pair? -- Evaler interface TypeCodeChar // go:Char s:char? TypeCodeBool // go:Bool s:boolean? TypeCodeProc // go:Proc s:procedure? -- Applier interface TypeCodeBinary // go:Binary s:bytevector? -- Seq interface TypeCodeNumber // go:Num s:number? -- Num interface TypeCodePort // go:Port s:port? -- Port interface TypeCodeString // go:String s:string? -- Seq interface TypeCodeSymbol // go:Symbol s:symbol? -- Evaler interface TypeCodeVector // go:Vector s:vector? -- Seq interface TypeCodeTable // go:Table s:hashtable? TypeCodeRecord // go:Record -- interface TypeCodeLibrary // TypeCodeValues // multiple return values TypeCodeSyntax // -- Transformer interface TypeCodeEnvSpec TypeCodeError TypeCodeLabel TypeCodeVoid TypeCodeMax // maximum )
TODO: s/TypeCode/Kind/g
func IsType(o Any, tag int) bool
type AdvancedMap interface { Map Add(value Named) }
type AnyKinder interface { GetType() int }
type Binary []byte
func NewBinary(s string) Binary
func (bv Binary) First() Any
Our implementation of (seq-first)
func (bv Binary) GetHash() uintptr
func (_ Binary) GetType() int
func (bv Binary) GoString() string
Our implementation of (->go-string)
func (bv Binary) Length() int
Our implementation of (seq-length)
func (bv Binary) RawString() string
Our implementation of (->immutable-string)
func (bv Binary) Ref(k Any) Any
Our implementation of (map-ref)
func (bv Binary) Rest() Seq
Our implementation of (seq-rest)
func (bv Binary) SchemeString() string
Our implementation of (->scheme-string)
func (bc Binary) Set(k, v Any) Any
Our implementation of (map-set!)
func (bv Binary) ToString() String
func (bv Binary) ToSymbol() Symbol
func (bv Binary) ToVector() Vector
Out implementation of (bytevector->u8-vector)
type CaseLambdaProc struct {
// contains filtered or unexported fields
}
type CaseSyntax struct {
// contains filtered or unexported fields
}
type Char rune
type Comparer interface { Compare(Any) int }
type Equaler interface { Equal(Any) bool }
type Error interface { Error() string Irritants() Any }
type ErrorObject struct {
// contains filtered or unexported fields
}
func (eo ErrorObject) Error() string
func (eo ErrorObject) GetErrorObjectType() int
func (eo ErrorObject) GetHash() uintptr
func (eo ErrorObject) GetType() int
func (eo ErrorObject) Irritants() Any
type GoStringer interface { GoString() string }
type Hasher interface { GetHash() uintptr }
type Kinder interface { Kind() reflect.Kind }
type LambdaProc struct {
// contains filtered or unexported fields
}
type Map interface { Define(key, value Any) Ref(key Any) Any RefDefault(key, value Any) Any Set(key, value Any) }
type Null struct{}
func (_ *Null) Equal(a Any) bool
func (o *Null) Eval(env *Env) Any
func (_ *Null) GetHash() uintptr
func (_ *Null) GetType() int
func (_ *Null) SchemeString() string
func (o *Null) ToVector() Any
type Num interface { IsExact() bool IsInexact() bool }
type Pair struct {
// contains filtered or unexported fields
}
func (o *Pair) Equal(a Any) bool
func (o *Pair) Eval(env *Env) Any
func (o *Pair) First() Any
func (o *Pair) GetHash() uintptr
func (o *Pair) GetType() int
func (o *Pair) Ref(key Any) Any
func (p *Pair) Match(syntax Any, env *Env) bool {
pas, pds := _carZIcdr(p) // pattern //fmt.Printf("List.Match[ %s, %s ]\n", p, syntax) if _pairZS(pds).(bool) { pads := pds.(*Pair).car if _symbolZS(pads).(bool) && pads.(Symbol).String() == "..." { //fmt.Printf("= ellipsis = %s\n", syntax) if _symbolZS(pas).(bool) { if env.Ref(pas) != nil { //KdumpZKenvironment(pas, pds, env) //fmt.Printf("= %s = %s\n", pas, env.Ref(pas)) //fmt.Printf("= %s | %s\n", p, syntax) _error("list-match expected unbound symbol") } if _nullZS(syntax).(bool) || _pairZS(syntax).(bool) { //env.DefMatch(pas, syntax) //fmt.Printf("= #t 0\n") return true } //fmt.Printf("= #f 4\n") return false } // TODO _error("ellipsis is only implemented for symbols") } } cas, cds := _carZIcdr(syntax) if !pas.(Matcher).Match(cas, env) { //fmt.Printf("= #f 1\n") return false } if !pds.(Matcher).Match(cds, env) { //fmt.Printf("= #f 2\n") return false } //fmt.Printf("= #t 3\n") return true
}
func (t *Pair) Replace(env *Env) Any {
tas, tds := _carZIcdr(t) if _pairZS(tds).(bool) { tads := tds.(*Pair).car if _symbolZS(tads).(bool) && tads.(Symbol).String() == "..." { return env.Ref(tas) } } car := tas.(Replacer).Replace(env) cdr := tds.(Replacer).Replace(env) return _cons(car, cdr)
}
func (o *Pair) RefDefault(key, value Any) Any
func (o *Pair) Rest() Any
func (ls *Pair) SchemeString() string
func (o *Pair) Set(key, value Any)
func (o *Pair) SetFirst(value Any)
func (o *Pair) SetRest(value Any)
func (o *Pair) ToVector() Any
type RulesSyntax struct {
// contains filtered or unexported fields
}
type STable struct {
// contains filtered or unexported fields
}
* The Go specification states that map types can have * any key types for which == and != are defined, which * includes any type except for function, map, or slice. * Droscheme uses ALOT of slice types, and so about 4 of the * types that implement Any are slice types, so instead of * map[Any]Any we have a map from uintptr (the hash type) * to a bucket slice, which we iterate through for equality.
type SType struct {
// contains filtered or unexported fields
}
type SchemeStringer interface { SchemeString() string }
type Seq interface { First() Any Length() int Rest() Seq }
type String []rune
func NewString(s string) String
func (st String) GetHash() uintptr
func (_ String) GetType() int
func (st String) GoString() string
func (st String) RawString() string
func (st String) Ref(k Any) Any
func (st String) Set(k, v Any) Any
func (st String) String() string
func (st String) ToBytes() []byte
func (st String) ToSymbol() Symbol
func (st String) ToVector() Vector
type Symbol struct {
// contains filtered or unexported fields
}
func NewSymbol(s string) Symbol
func (o Symbol) Equal(a Any) bool
func (o Symbol) Eval(env *Env) Any
func (o Symbol) GetHash() uintptr
func (o Symbol) GetType() int
func (o Symbol) Match(syntax Any, env *Env) bool
func (o Symbol) Replace(env *Env) Any
func (sy Symbol) SchemeString() string
func (sy Symbol) String() string
func (sy Symbol) ToString() String
func (sy Symbol) ToVector() Vector
type Values []Any
func (_ Values) GetType() int
type Vector []Any
func (vc Vector) Equal(a Any) bool
Our implementation of (object-equal?)
func (vc Vector) Eval(env *Env) Any
Our implementation of (eval)
func (vc Vector) GetHash() uintptr
Our implementation of (object-hash)
func (vc Vector) GetType() int
Our implementation of (object-type)
func (vc Vector) Ref(k Any) Any
Our implementation of (map-ref)
func (vc Vector) SchemeString() string
Our implementation of (->scheme-string)
func (vc Vector) Set(k, v Any) Any
Our implementation of (map-set!)
func (vc Vector) ToBinary() Binary
func (vc Vector) ToList() Any
Our implementation of (vector->list)
func (vc Vector) ToString() String
Our implementation of (vector->string)
type Void struct{}
func (_ Void) Equal(a Any) bool
func (_ Void) GetHash() uintptr
func (_ Void) GetType() int
func (_ Void) String() string