Package ds_any_runtime

import "ds/any/runtime"
Overview
Index

Overview

Package ds/any/runtime represents the Scheme library (ds any runtime).

This package represents the Scheme library (ds any runtime)

Index

Constants
func IsType(o Any, tag int) bool
type AdvancedMap
type AnyKinder
type Binary
    func NewBinary(s string) Binary
    func (bv Binary) First() Any
    func (bv Binary) GetHash() uintptr
    func (_ Binary) GetType() int
    func (bv Binary) GoString() string
    func (bv Binary) Length() int
    func (bv Binary) RawString() string
    func (bv Binary) Ref(k Any) Any
    func (bv Binary) Rest() Seq
    func (bv Binary) SchemeString() string
    func (bc Binary) Set(k, v Any) Any
    func (bv Binary) ToString() String
    func (bv Binary) ToSymbol() Symbol
    func (bv Binary) ToVector() Vector
type CaseLambdaProc
type CaseSyntax
type Char
type Comparer
type Equaler
type Error
type ErrorObject
    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
type Hasher
type Kinder
type LambdaProc
type Map
type Null
    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
type Pair
    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 (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
type STable
type SType
type SchemeStringer
type Seq
type String
    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
    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
    func (_ Values) GetType() int
type Vector
    func (vc Vector) Equal(a Any) bool
    func (vc Vector) Eval(env *Env) Any
    func (vc Vector) GetHash() uintptr
    func (vc Vector) GetType() int
    func (vc Vector) Ref(k Any) Any
    func (vc Vector) SchemeString() string
    func (vc Vector) Set(k, v Any) Any
    func (vc Vector) ToBinary() Binary
    func (vc Vector) ToList() Any
    func (vc Vector) ToString() String
type Void
    func (_ Void) Equal(a Any) bool
    func (_ Void) GetHash() uintptr
    func (_ Void) GetType() int
    func (_ Void) String() string

Package files

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

Constants

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

func IsType(o Any, tag int) bool

type AdvancedMap

type AdvancedMap interface {
    Map
    Add(value Named)
}

type AnyKinder

type AnyKinder interface {
    GetType() int
}

type Binary

type Binary []byte

func NewBinary

func NewBinary(s string) Binary

func (Binary) First

func (bv Binary) First() Any

Our implementation of (seq-first)

func (Binary) GetHash

func (bv Binary) GetHash() uintptr

func (Binary) GetType

func (_ Binary) GetType() int

func (Binary) GoString

func (bv Binary) GoString() string

Our implementation of (->go-string)

func (Binary) Length

func (bv Binary) Length() int

Our implementation of (seq-length)

func (Binary) RawString

func (bv Binary) RawString() string

Our implementation of (->immutable-string)

func (Binary) Ref

func (bv Binary) Ref(k Any) Any

Our implementation of (map-ref)

func (Binary) Rest

func (bv Binary) Rest() Seq

Our implementation of (seq-rest)

func (Binary) SchemeString

func (bv Binary) SchemeString() string

Our implementation of (->scheme-string)

func (Binary) Set

func (bc Binary) Set(k, v Any) Any

Our implementation of (map-set!)

func (Binary) ToString

func (bv Binary) ToString() String

func (Binary) ToSymbol

func (bv Binary) ToSymbol() Symbol

func (Binary) ToVector

func (bv Binary) ToVector() Vector

Out implementation of (bytevector->u8-vector)

type CaseLambdaProc

type CaseLambdaProc struct {
    // contains filtered or unexported fields
}

type CaseSyntax

type CaseSyntax struct {
    // contains filtered or unexported fields
}

type Char

type Char rune

type Comparer

type Comparer interface {
    Compare(Any) int
}

type Equaler

type Equaler interface {
    Equal(Any) bool
}

type Error

type Error interface {
    Error() string
    Irritants() Any
}

type ErrorObject

type ErrorObject struct {
    // contains filtered or unexported fields
}

func (ErrorObject) Error

func (eo ErrorObject) Error() string

func (ErrorObject) GetErrorObjectType

func (eo ErrorObject) GetErrorObjectType() int

func (ErrorObject) GetHash

func (eo ErrorObject) GetHash() uintptr

func (ErrorObject) GetType

func (eo ErrorObject) GetType() int

func (ErrorObject) Irritants

func (eo ErrorObject) Irritants() Any

type GoStringer

type GoStringer interface {
    GoString() string
}

type Hasher

type Hasher interface {
    GetHash() uintptr
}

type Kinder

type Kinder interface {
    Kind() reflect.Kind
}

type LambdaProc

type LambdaProc struct {
    // contains filtered or unexported fields
}

type Map

type Map interface {
    Define(key, value Any)
    Ref(key Any) Any
    RefDefault(key, value Any) Any
    Set(key, value Any)
}

type Null

type Null struct{}

func (*Null) Equal

func (_ *Null) Equal(a Any) bool

func (*Null) Eval

func (o *Null) Eval(env *Env) Any

func (*Null) GetHash

func (_ *Null) GetHash() uintptr

func (*Null) GetType

func (_ *Null) GetType() int

func (*Null) SchemeString

func (_ *Null) SchemeString() string

func (*Null) ToVector

func (o *Null) ToVector() Any

type Num

type Num interface {
    IsExact() bool
    IsInexact() bool
}

type Pair

type Pair struct {
    // contains filtered or unexported fields
}

func (*Pair) Equal

func (o *Pair) Equal(a Any) bool

func (*Pair) Eval

func (o *Pair) Eval(env *Env) Any

func (*Pair) First

func (o *Pair) First() Any

func (*Pair) GetHash

func (o *Pair) GetHash() uintptr

func (*Pair) GetType

func (o *Pair) GetType() int

func (*Pair) Ref

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 (*Pair) RefDefault

func (o *Pair) RefDefault(key, value Any) Any

func (*Pair) Rest

func (o *Pair) Rest() Any

func (*Pair) SchemeString

func (ls *Pair) SchemeString() string

func (*Pair) Set

func (o *Pair) Set(key, value Any)

func (*Pair) SetFirst

func (o *Pair) SetFirst(value Any)

func (*Pair) SetRest

func (o *Pair) SetRest(value Any)

func (*Pair) ToVector

func (o *Pair) ToVector() Any

type RulesSyntax

type RulesSyntax struct {
    // contains filtered or unexported fields
}

type STable

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

type SType struct {
    // contains filtered or unexported fields
}

type SchemeStringer

type SchemeStringer interface {
    SchemeString() string
}

type Seq

type Seq interface {
    First() Any
    Length() int
    Rest() Seq
}

type String

type String []rune

func NewString

func NewString(s string) String

func (String) GetHash

func (st String) GetHash() uintptr

func (String) GetType

func (_ String) GetType() int

func (String) GoString

func (st String) GoString() string

func (String) RawString

func (st String) RawString() string

func (String) Ref

func (st String) Ref(k Any) Any

func (String) Set

func (st String) Set(k, v Any) Any

func (String) String

func (st String) String() string

func (String) ToBytes

func (st String) ToBytes() []byte

func (String) ToSymbol

func (st String) ToSymbol() Symbol

func (String) ToVector

func (st String) ToVector() Vector

type Symbol

type Symbol struct {
    // contains filtered or unexported fields
}

func NewSymbol

func NewSymbol(s string) Symbol

func (Symbol) Equal

func (o Symbol) Equal(a Any) bool

func (Symbol) Eval

func (o Symbol) Eval(env *Env) Any

func (Symbol) GetHash

func (o Symbol) GetHash() uintptr

func (Symbol) GetType

func (o Symbol) GetType() int

func (Symbol) Match

func (o Symbol) Match(syntax Any, env *Env) bool

func (Symbol) Replace

func (o Symbol) Replace(env *Env) Any

func (Symbol) SchemeString

func (sy Symbol) SchemeString() string

func (Symbol) String

func (sy Symbol) String() string

func (Symbol) ToString

func (sy Symbol) ToString() String

func (Symbol) ToVector

func (sy Symbol) ToVector() Vector

type Values

type Values []Any

func (Values) GetType

func (_ Values) GetType() int

type Vector

type Vector []Any

func (Vector) Equal

func (vc Vector) Equal(a Any) bool

Our implementation of (object-equal?)

func (Vector) Eval

func (vc Vector) Eval(env *Env) Any

Our implementation of (eval)

func (Vector) GetHash

func (vc Vector) GetHash() uintptr

Our implementation of (object-hash)

func (Vector) GetType

func (vc Vector) GetType() int

Our implementation of (object-type)

func (Vector) Ref

func (vc Vector) Ref(k Any) Any

Our implementation of (map-ref)

func (Vector) SchemeString

func (vc Vector) SchemeString() string

Our implementation of (->scheme-string)

func (Vector) Set

func (vc Vector) Set(k, v Any) Any

Our implementation of (map-set!)

func (Vector) ToBinary

func (vc Vector) ToBinary() Binary

func (Vector) ToList

func (vc Vector) ToList() Any

Our implementation of (vector->list)

func (Vector) ToString

func (vc Vector) ToString() String

Our implementation of (vector->string)

type Void

type Void struct{}

func (Void) Equal

func (_ Void) Equal(a Any) bool

func (Void) GetHash

func (_ Void) GetHash() uintptr

func (Void) GetType

func (_ Void) GetType() int

func (Void) String

func (_ Void) String() string