Documentation
¶
Index ¶
- Constants
- Variables
- func FormatError(err error) string
- func HashValue(v Value) uint32
- func IsBigInt(v Value) bool
- func IsNumber(v Value) bool
- func IsReduced(v Value) bool
- func IsTruthy(v Value) bool
- func NumEq(a, b Value) bool
- func NumGe(a, b Value) (bool, error)
- func NumGt(a, b Value) (bool, error)
- func NumLe(a, b Value) (bool, error)
- func NumLt(a, b Value) (bool, error)
- func OpcodeToString(op int32) string
- func ReleaseFrame(f *Frame)
- func SetNSLookup(fn func(string) *Namespace)
- func SetValueEquals(fn func(a, b Value) bool)
- func ToBigInt(v Value) (*big.Int, bool)
- func ToFloat(v Value) (float64, bool)
- func ToInt(v Value) (int, bool)
- func ToStruct[T any](r *Record) (T, error)
- type ArrayKind
- type ArrayVector
- func (l ArrayVector) Arity() int
- func (l ArrayVector) Assoc(k Value, v Value) Associative
- func (l ArrayVector) Conj(val Value) Collection
- func (l ArrayVector) Cons(val Value) Seq
- func (l ArrayVector) Contains(value Value) Boolean
- func (l ArrayVector) Count() Value
- func (l ArrayVector) Dissoc(k Value) Associative
- func (l ArrayVector) Empty() Collection
- func (l ArrayVector) Equals(other Value) bool
- func (l ArrayVector) First() Value
- func (l ArrayVector) Hash() uint32
- func (l ArrayVector) Invoke(pargs []Value) (Value, error)
- func (l ArrayVector) Meta() Value
- func (l ArrayVector) More() Seq
- func (l ArrayVector) Next() Seq
- func (l ArrayVector) RawCount() int
- func (l ArrayVector) Seq() Seq
- func (l ArrayVector) String() string
- func (l ArrayVector) Type() ValueType
- func (l ArrayVector) Unbox() interface{}
- func (l ArrayVector) ValueAt(key Value) Value
- func (l ArrayVector) ValueAtOr(key Value, dflt Value) Value
- func (l ArrayVector) WithMeta(m Value) Value
- type ArrayVectorSeq
- func (s *ArrayVectorSeq) Conj(val Value) Collection
- func (s *ArrayVectorSeq) Cons(val Value) Seq
- func (s *ArrayVectorSeq) Count() Value
- func (s *ArrayVectorSeq) Empty() Collection
- func (s *ArrayVectorSeq) First() Value
- func (s *ArrayVectorSeq) More() Seq
- func (s *ArrayVectorSeq) Next() Seq
- func (s *ArrayVectorSeq) RawCount() int
- func (s *ArrayVectorSeq) Seq() Seq
- func (s *ArrayVectorSeq) String() string
- func (s *ArrayVectorSeq) Type() ValueType
- func (s *ArrayVectorSeq) Unbox() interface{}
- func (s *ArrayVectorSeq) ValueAt(key Value) Value
- func (s *ArrayVectorSeq) ValueAtOr(key Value, dflt Value) Value
- type Associative
- type Atom
- func (a *Atom) AddWatch(key Value, fn Fn)
- func (a *Atom) AlterMeta(fn Fn, args []Value) (Value, error)
- func (a *Atom) Deref() Value
- func (a *Atom) Meta() Value
- func (a *Atom) RemoveWatch(key Value)
- func (a *Atom) Reset(newVal Value) Value
- func (v *Atom) String() string
- func (a *Atom) Swap(fn Fn, args []Value) (Value, error)
- func (v *Atom) Type() ValueType
- func (v *Atom) Unbox() interface{}
- func (a *Atom) WithMeta(m Value) Value
- type BigInt
- type Boolean
- type Boxed
- type Chan
- type Char
- type Closure
- type CodeChunk
- func (c *CodeChunk) AddSourceInfo(info SourceInfo)
- func (c *CodeChunk) Append(insts ...int32)
- func (c *CodeChunk) Append32(val int)
- func (c *CodeChunk) AppendChunk(o *CodeChunk)
- func (c *CodeChunk) Code() []int32
- func (c *CodeChunk) Consts() *Consts
- func (c *CodeChunk) Debug()
- func (c *CodeChunk) Get(idx int) (int32, error)
- func (c *CodeChunk) Get32(idx int) (int, error)
- func (c *CodeChunk) GetSourceMap() *SourceMap
- func (c *CodeChunk) Length() int
- func (c *CodeChunk) LookupSource(ip int) *SourceInfo
- func (c *CodeChunk) MaxStack() int
- func (c *CodeChunk) SetMaxStack(max int)
- func (c *CodeChunk) Update32(address int, value int32)
- type Collection
- type Cons
- func (c *Cons) Conj(val Value) Collection
- func (c *Cons) Cons(val Value) Seq
- func (c *Cons) Count() Value
- func (c *Cons) Empty() Collection
- func (c *Cons) First() Value
- func (c *Cons) More() Seq
- func (c *Cons) Next() Seq
- func (c *Cons) RawCount() int
- func (c *Cons) Seq() Seq
- func (c *Cons) String() string
- func (c *Cons) Type() ValueType
- func (c *Cons) Unbox() interface{}
- type Consts
- type Counted
- type Delay
- type ExInfo
- type ExecutionError
- type Float
- type Fn
- type Frame
- type Func
- func (l *Func) Arity() int
- func (l *Func) Chunk() *CodeChunk
- func (l *Func) FuncName() string
- func (l *Func) Invoke(pargs []Value) (result Value, err error)
- func (l *Func) IsVariadic() bool
- func (l *Func) MakeClosure() Fn
- func (l *Func) SetName(n string)
- func (l *Func) String() string
- func (l *Func) Type() ValueType
- func (l *Func) Unbox() interface{}
- type FuncInterface
- type Hashable
- type IMeta
- type InfiniteRange
- func (r *InfiniteRange) Cons(val Value) Seq
- func (r *InfiniteRange) First() Value
- func (r *InfiniteRange) More() Seq
- func (r *InfiniteRange) Next() Seq
- func (r *InfiniteRange) Seq() Seq
- func (r *InfiniteRange) String() string
- func (r *InfiniteRange) Type() ValueType
- func (r *InfiniteRange) Unbox() interface{}
- type Int
- type Iterate
- type Keyed
- type Keyword
- func (l Keyword) Arity() int
- func (l Keyword) Hash() uint32
- func (l Keyword) Invoke(pargs []Value) (Value, error)
- func (l Keyword) Name() Value
- func (l Keyword) Namespace() Value
- func (l Keyword) Namespaced() (Value, Value)
- func (l Keyword) String() string
- func (l Keyword) Type() ValueType
- func (l Keyword) Unbox() interface{}
- type LazySeq
- func (l *LazySeq) Conj(val Value) Collection
- func (l *LazySeq) Cons(val Value) Seq
- func (l *LazySeq) Count() Value
- func (l *LazySeq) Empty() Collection
- func (l *LazySeq) First() Value
- func (l *LazySeq) More() Seq
- func (l *LazySeq) Next() Seq
- func (l *LazySeq) RawCount() int
- func (l *LazySeq) Resolve() Seq
- func (l *LazySeq) Seq() Seq
- func (l *LazySeq) String() string
- func (l *LazySeq) Type() ValueType
- func (l *LazySeq) Unbox() interface{}
- func (l *LazySeq) ValueAt(key Value) Value
- func (l *LazySeq) ValueAtOr(key Value, notFound Value) Value
- type List
- func (l *List) Conj(value Value) Collection
- func (l *List) Cons(val Value) Seq
- func (l *List) Count() Value
- func (l *List) Empty() Collection
- func (l *List) First() Value
- func (l *List) Hash() uint32
- func (l *List) Meta() Value
- func (l *List) More() Seq
- func (l *List) Next() Seq
- func (l *List) RawCount() int
- func (l *List) Seq() Seq
- func (l *List) String() string
- func (l *List) Type() ValueType
- func (l *List) Unbox() interface{}
- func (l *List) ValueAt(key Value) Value
- func (l *List) ValueAtOr(key Value, dflt Value) Value
- func (l *List) WithMeta(m Value) Value
- type Lookup
- type Map
- func (l Map) Arity() int
- func (l Map) Assoc(k Value, v Value) Associative
- func (l Map) Conj(value Value) Collection
- func (l Map) Cons(val Value) Seq
- func (l Map) Contains(value Value) Boolean
- func (l Map) Count() Value
- func (l Map) Dissoc(k Value) Associative
- func (l Map) Empty() Collection
- func (l Map) First() Value
- func (l Map) Invoke(pargs []Value) (Value, error)
- func (l Map) More() Seq
- func (l Map) Next() Seq
- func (l Map) RawCount() int
- func (l Map) Seq() Seq
- func (l Map) String() string
- func (l Map) Type() ValueType
- func (l Map) Unbox() interface{}
- func (l Map) ValueAt(key Value) Value
- func (l Map) ValueAtOr(key Value, dflt Value) Value
- type MapEntry
- type MapSeq
- func (s *MapSeq) Conj(val Value) Collection
- func (s *MapSeq) Cons(val Value) Seq
- func (s *MapSeq) Count() Value
- func (s *MapSeq) Empty() Collection
- func (s *MapSeq) First() Value
- func (s *MapSeq) More() Seq
- func (s *MapSeq) Next() Seq
- func (s *MapSeq) RawCount() int
- func (s *MapSeq) Seq() Seq
- func (s *MapSeq) String() string
- func (s *MapSeq) Type() ValueType
- func (s *MapSeq) Unbox() interface{}
- type MultiArityFn
- type MultiFn
- func (m *MultiFn) AddMethod(dispatchVal Value, method Fn) *MultiFn
- func (m *MultiFn) Arity() int
- func (m *MultiFn) Invoke(args []Value) (Value, error)
- func (m *MultiFn) Methods() *PersistentMap
- func (m *MultiFn) RemoveMethod(dispatchVal Value) *MultiFn
- func (m *MultiFn) String() string
- func (m *MultiFn) Type() ValueType
- func (m *MultiFn) Unbox() interface{}
- type Named
- type Namespace
- func (n *Namespace) Alias(alias Symbol, target *Namespace)
- func (n *Namespace) Def(name string, val Value) *Var
- func (n *Namespace) ImportVar(from *Namespace, name Symbol, alias Symbol) bool
- func (n *Namespace) Lookup(symbol Symbol) Value
- func (n *Namespace) LookupLocal(symbol Symbol) *Var
- func (n *Namespace) LookupOrAdd(symbol Symbol) Value
- func (n *Namespace) Name() string
- func (n *Namespace) Refer(ns *Namespace, alias string, all bool)
- func (n *Namespace) ReferList(ns *Namespace, symbols []Symbol)
- func (n *Namespace) RegistrySize() int
- func (n *Namespace) ResolveAlias(alias Symbol) *Namespace
- func (n *Namespace) String() string
- func (n *Namespace) Type() ValueType
- func (n *Namespace) Unbox() interface{}
- type NativeFn
- func (l *NativeFn) Arity() int
- func (l *NativeFn) Invoke(args []Value) (ret Value, err error)
- func (l *NativeFn) SetName(n string)
- func (l *NativeFn) String() string
- func (l *NativeFn) Type() ValueType
- func (l *NativeFn) Unbox() interface{}
- func (l *NativeFn) WithArity(arity int, variadric bool) *NativeFn
- type Nil
- func (l *Nil) Assoc(k Value, v Value) Associative
- func (n *Nil) Conj(value Value) Collection
- func (n *Nil) Cons(value Value) Seq
- func (n *Nil) Count() Value
- func (l *Nil) Dissoc(k Value) Associative
- func (n *Nil) Empty() Collection
- func (n *Nil) First() Value
- func (n *Nil) More() Seq
- func (n *Nil) Next() Seq
- func (n *Nil) RawCount() int
- func (n *Nil) Seq() Seq
- func (n *Nil) String() string
- func (n *Nil) Type() ValueType
- func (n *Nil) Unbox() interface{}
- type PersistentMap
- func (m *PersistentMap) Arity() int
- func (m *PersistentMap) Assoc(key Value, val Value) Associative
- func (m *PersistentMap) Conj(value Value) Collection
- func (m *PersistentMap) Contains(key Value) Boolean
- func (m *PersistentMap) Count() Value
- func (m *PersistentMap) Dissoc(key Value) Associative
- func (m *PersistentMap) Empty() Collection
- func (m *PersistentMap) Equals(other Value) bool
- func (m *PersistentMap) Hash() uint32
- func (m *PersistentMap) Invoke(pargs []Value) (Value, error)
- func (m *PersistentMap) Meta() Value
- func (m *PersistentMap) RawCount() int
- func (m *PersistentMap) Seq() Seq
- func (m *PersistentMap) String() string
- func (m *PersistentMap) Type() ValueType
- func (m *PersistentMap) Unbox() interface{}
- func (m *PersistentMap) ValueAt(key Value) Value
- func (m *PersistentMap) ValueAtOr(key Value, dflt Value) Value
- func (m *PersistentMap) WithMeta(meta Value) Value
- type PersistentSet
- func (s *PersistentSet) Arity() int
- func (s *PersistentSet) Conj(value Value) Collection
- func (s *PersistentSet) Cons(val Value) Seq
- func (s *PersistentSet) Contains(value Value) Boolean
- func (s *PersistentSet) Count() Value
- func (s *PersistentSet) Disj(value Value) *PersistentSet
- func (s *PersistentSet) Empty() Collection
- func (s *PersistentSet) First() Value
- func (s *PersistentSet) Hash() uint32
- func (s *PersistentSet) Invoke(pargs []Value) (Value, error)
- func (s *PersistentSet) Meta() Value
- func (s *PersistentSet) More() Seq
- func (s *PersistentSet) Next() Seq
- func (s *PersistentSet) RawCount() int
- func (s *PersistentSet) Seq() Seq
- func (s *PersistentSet) String() string
- func (s *PersistentSet) Type() ValueType
- func (s *PersistentSet) Unbox() interface{}
- func (s *PersistentSet) WithMeta(m Value) Value
- type PersistentVector
- func (v PersistentVector) Arity() int
- func (v PersistentVector) Assoc(key Value, val Value) Associative
- func (v PersistentVector) Conj(val Value) Collection
- func (v PersistentVector) Contains(key Value) Boolean
- func (v PersistentVector) Count() Value
- func (v PersistentVector) Dissoc(key Value) Associative
- func (v PersistentVector) Empty() Collection
- func (v PersistentVector) Equals(other Value) bool
- func (v PersistentVector) Hash() uint32
- func (v PersistentVector) Invoke(args []Value) (Value, error)
- func (v PersistentVector) Meta() Value
- func (v PersistentVector) RawCount() int
- func (v PersistentVector) Seq() Seq
- func (v PersistentVector) String() string
- func (v PersistentVector) Type() ValueType
- func (v PersistentVector) Unbox() interface{}
- func (v PersistentVector) ValueAt(key Value) Value
- func (v PersistentVector) ValueAtOr(key Value, dflt Value) Value
- func (v PersistentVector) WithMeta(m Value) Value
- type PersistentVectorSeq
- func (s *PersistentVectorSeq) Conj(val Value) Collection
- func (s *PersistentVectorSeq) Cons(val Value) Seq
- func (s *PersistentVectorSeq) Count() Value
- func (s *PersistentVectorSeq) Empty() Collection
- func (s *PersistentVectorSeq) First() Value
- func (s *PersistentVectorSeq) More() Seq
- func (s *PersistentVectorSeq) Next() Seq
- func (s *PersistentVectorSeq) RawCount() int
- func (s *PersistentVectorSeq) String() string
- func (s *PersistentVectorSeq) Type() ValueType
- func (s *PersistentVectorSeq) Unbox() interface{}
- func (s *PersistentVectorSeq) ValueAt(key Value) Value
- func (s *PersistentVectorSeq) ValueAtOr(key Value, dflt Value) Value
- type Promise
- type Protocol
- func (p *Protocol) Extend(vt ValueType, implMap *PersistentMap)
- func (p *Protocol) ExtendNil(implMap *PersistentMap)
- func (p *Protocol) Lookup(methodName Symbol, target Value) (Fn, bool)
- func (p *Protocol) Methods() []Symbol
- func (p *Protocol) Name() string
- func (p *Protocol) Satisfies(target Value) bool
- func (p *Protocol) String() string
- func (p *Protocol) Type() ValueType
- func (p *Protocol) Unbox() interface{}
- type ProtocolFn
- type Range
- func (l *Range) Conj(val Value) Collection
- func (l *Range) Cons(val Value) Seq
- func (l *Range) Count() Value
- func (l *Range) Empty() Collection
- func (l *Range) First() Value
- func (l *Range) More() Seq
- func (l *Range) Next() Seq
- func (l *Range) RawCount() int
- func (l *Range) Seq() Seq
- func (l *Range) String() string
- func (l *Range) Type() ValueType
- func (l *Range) Unbox() interface{}
- func (l *Range) ValueAt(key Value) Value
- func (l *Range) ValueAtOr(key Value, dflt Value) Value
- type Receiver
- type Record
- func (r *Record) Arity() int
- func (r *Record) Assoc(key Value, val Value) Associative
- func (r *Record) Conj(value Value) Collection
- func (r *Record) Contains(key Value) Boolean
- func (r *Record) Count() Value
- func (r *Record) Dissoc(key Value) Associative
- func (r *Record) Empty() Collection
- func (r *Record) Equals(other Value) bool
- func (r *Record) Extra() *PersistentMap
- func (r *Record) FixedFields() []Value
- func (r *Record) Hash() uint32
- func (r *Record) Invoke(args []Value) (Value, error)
- func (r *Record) InvokeMethod(name Symbol, args []Value) (Value, error)
- func (r *Record) Meta() Value
- func (r *Record) Origin() interface{}
- func (r *Record) RawCount() int
- func (r *Record) RecordType() *RecordType
- func (r *Record) Seq() Seq
- func (r *Record) String() string
- func (r *Record) Type() ValueType
- func (r *Record) Unbox() interface{}
- func (r *Record) ValueAt(key Value) Value
- func (r *Record) ValueAtOr(key Value, notFound Value) Value
- func (r *Record) WithMeta(m Value) Value
- type RecordType
- type Reduced
- type Refer
- type Reference
- type Regex
- func (l *Regex) FindAllString(s string, n int) []string
- func (l *Regex) FindAllStringSubmatch(s string, n int) [][]string
- func (l *Regex) FindStringSubmatch(s string) []string
- func (l *Regex) Pattern() string
- func (l *Regex) ReplaceAll(s string, replacement string) string
- func (l *Regex) String() string
- func (l *Regex) Type() ValueType
- func (l *Regex) Unbox() interface{}
- type Repeat
- func (n *Repeat) Cons(value Value) Seq
- func (n *Repeat) Count() Value
- func (n *Repeat) First() Value
- func (n *Repeat) More() Seq
- func (n *Repeat) Next() Seq
- func (n *Repeat) RawCount() int
- func (n *Repeat) Seq() Seq
- func (n *Repeat) String() string
- func (n *Repeat) Type() ValueType
- func (n *Repeat) Unbox() interface{}
- type Seq
- type Sequable
- type Set
- func (l Set) Arity() int
- func (l Set) Conj(value Value) Collection
- func (l Set) Cons(val Value) Seq
- func (l Set) Contains(value Value) Boolean
- func (l Set) Count() Value
- func (l Set) Disj(value Value) Set
- func (l Set) Empty() Collection
- func (l Set) First() Value
- func (l Set) Hash() uint32
- func (l Set) Invoke(pargs []Value) (Value, error)
- func (l Set) Meta() Value
- func (l Set) More() Seq
- func (l Set) Next() Seq
- func (l Set) RawCount() int
- func (l Set) Seq() Seq
- func (l Set) String() string
- func (l Set) Type() ValueType
- func (l Set) Unbox() interface{}
- func (l Set) WithMeta(m Value) Value
- type SetSeq
- func (s *SetSeq) Conj(val Value) Collection
- func (s *SetSeq) Cons(val Value) Seq
- func (s *SetSeq) Count() Value
- func (s *SetSeq) Empty() Collection
- func (s *SetSeq) First() Value
- func (s *SetSeq) More() Seq
- func (s *SetSeq) Next() Seq
- func (s *SetSeq) RawCount() int
- func (s *SetSeq) Seq() Seq
- func (s *SetSeq) String() string
- func (s *SetSeq) Type() ValueType
- func (s *SetSeq) Unbox() interface{}
- type SetWithMeta
- type SourceInfo
- type SourceMap
- type SourceMapEntry
- type String
- func (l String) Conj(value Value) Collection
- func (l String) Cons(val Value) Seq
- func (l String) Count() Value
- func (l String) Empty() Collection
- func (l String) First() Value
- func (l String) Hash() uint32
- func (l String) More() Seq
- func (l String) Next() Seq
- func (l String) RawCount() int
- func (l String) Seq() Seq
- func (l String) String() string
- func (l String) Type() ValueType
- func (l String) Unbox() interface{}
- func (l String) ValueAt(key Value) Value
- func (l String) ValueAtOr(key Value, dflt Value) Value
- type StructMapping
- type Symbol
- type ThrownError
- type TransientMap
- func (t *TransientMap) Assoc(key Value, val Value) (*TransientMap, error)
- func (t *TransientMap) Conj(value Value) (*TransientMap, error)
- func (t *TransientMap) Count() Value
- func (t *TransientMap) Dissoc(key Value) (*TransientMap, error)
- func (t *TransientMap) Persistent() *PersistentMap
- func (t *TransientMap) RawCount() int
- func (t *TransientMap) String() string
- func (t *TransientMap) Type() ValueType
- func (t *TransientMap) Unbox() interface{}
- func (t *TransientMap) ValueAt(key Value) Value
- func (t *TransientMap) ValueAtOr(key Value, notFound Value) Value
- type TransientVector
- func (t *TransientVector) Assoc(key Value, val Value) (*TransientVector, error)
- func (t *TransientVector) Conj(value Value) (*TransientVector, error)
- func (t *TransientVector) Count() Value
- func (t *TransientVector) Persistent() Value
- func (t *TransientVector) RawCount() int
- func (t *TransientVector) String() string
- func (t *TransientVector) Type() ValueType
- func (t *TransientVector) Unbox() interface{}
- func (t *TransientVector) ValueAt(key Value) Value
- type TypeError
- type TypedArray
- func NewByteArray(size int) *TypedArray
- func NewByteArrayFrom(data []byte) *TypedArray
- func NewFloatArray(size int) *TypedArray
- func NewFloatArrayFrom(data []float64) *TypedArray
- func NewIntArray(size int) *TypedArray
- func NewIntArrayFrom(data []int64) *TypedArray
- func NewObjectArray(size int) *TypedArray
- func NewObjectArrayFrom(data []Value) *TypedArray
- func (a *TypedArray) Arity() int
- func (a *TypedArray) Clone() *TypedArray
- func (a *TypedArray) Conj(v Value) Collection
- func (a *TypedArray) Count() Value
- func (a *TypedArray) Empty() Collection
- func (a *TypedArray) Get(i int) Value
- func (a *TypedArray) Invoke(args []Value) (Value, error)
- func (a *TypedArray) Kind() ArrayKind
- func (a *TypedArray) Len() int
- func (a *TypedArray) Meta() Value
- func (a *TypedArray) RawCount() int
- func (a *TypedArray) Seq() Seq
- func (a *TypedArray) Set(i int, v Value) error
- func (a *TypedArray) String() string
- func (a *TypedArray) Type() ValueType
- func (a *TypedArray) Unbox() interface{}
- func (a *TypedArray) ValueAt(key Value) Value
- func (a *TypedArray) ValueAtOr(key Value, dflt Value) Value
- func (a *TypedArray) WithMeta(_ Value) Value
- type TypedArraySeq
- func (s *TypedArraySeq) Conj(val Value) Collection
- func (s *TypedArraySeq) Cons(val Value) Seq
- func (s *TypedArraySeq) Count() Value
- func (s *TypedArraySeq) Empty() Collection
- func (s *TypedArraySeq) First() Value
- func (s *TypedArraySeq) Meta() Value
- func (s *TypedArraySeq) More() Seq
- func (s *TypedArraySeq) Next() Seq
- func (s *TypedArraySeq) RawCount() int
- func (s *TypedArraySeq) Seq() Seq
- func (s *TypedArraySeq) String() string
- func (s *TypedArraySeq) Type() ValueType
- func (s *TypedArraySeq) Unbox() interface{}
- func (s *TypedArraySeq) ValueAt(key Value) Value
- func (s *TypedArraySeq) ValueAtOr(key Value, dflt Value) Value
- func (s *TypedArraySeq) WithMeta(_ Value) Value
- type Value
- func BoxValue(v reflect.Value) (Value, error)
- func MakeFloat(v float64) Value
- func MakeInt(v int) Value
- func MaybeDowngrade(b *big.Int) Value
- func NewArrayVector(v []Value) Value
- func NewList(vs []Value) Value
- func NewMap(v []Value) Value
- func NewPersistentVector(values []Value) Value
- func NewRange(start, end, step Int) Value
- func NewRegex(s string) (Value, error)
- func NewSet(v []Value) Value
- func NumAbs(a Value) (Value, error)
- func NumAdd(a, b Value) (Value, error)
- func NumDiv(a, b Value) (Value, error)
- func NumMod(a, b Value) (Value, error)
- func NumMul(a, b Value) (Value, error)
- func NumNeg(a Value) (Value, error)
- func NumQuot(a, b Value) (Value, error)
- func NumRem(a, b Value) (Value, error)
- func NumSub(a, b Value) (Value, error)
- func ToLetGo(v interface{}) (Value, error)
- type ValueType
- type Var
- func (v *Var) Arity() int
- func (v *Var) Deref() Value
- func (v *Var) Invoke(values []Value) (Value, error)
- func (v *Var) IsDynamic() bool
- func (v *Var) IsMacro() bool
- func (v *Var) IsPrivate() bool
- func (v *Var) NS() string
- func (v *Var) PopBinding()
- func (v *Var) PushBinding(val Value)
- func (v *Var) SetDynamic()
- func (v *Var) SetMacro()
- func (v *Var) SetPrivate()
- func (v *Var) SetRoot(val Value) *Var
- func (v *Var) String() string
- func (v *Var) Type() ValueType
- func (v *Var) Unbox() interface{}
- func (v *Var) VarName() string
- type Void
- type Volatile
Constants ¶
const ( OP_NOOP int32 = iota // do nothing OP_LOAD_CONST // load constant LDC (index int32) OP_LOAD_ARG // load argument LDA (index int32) OP_INVOKE // invoke function OP_RETURN // return from function OP_BRANCH_TRUE // branch if truthy BRANCH_TRUE (offset int32) OP_BRANCH_FALSE // branch if falsy BRF (offset int32) OP_JUMP // jump by offset JMP (offset int32) OP_POP // pop value from the stack and discard it OP_POP_N // save top and pop n elements from the stack POP_N (n int32) OP_DUP_NTH // duplicate nth value from the stack OPN (n int32) OP_SET_VAR // set var OP_LOAD_VAR // push var root OP_MAKE_CLOSURE // make a closure out of fn OP_LOAD_CLOSEDOVER // load closed over LDK (index int32) OP_PUSH_CLOSEDOVER // push closed over value to a closure OP_RECUR // loop recurse RECUR (offset int32, argc int32) OP_RECUR_FN // function recurse REF (argc int32) OP_TRACE_ENABLE // enable tracing OP_TRACE_DISABLE // disable tracing OP_MAKE_MULTI_ARITY // make multi-arity function (n int32) OP_TAIL_CALL // like OP_INVOKE but re-uses the frame OP_TRY_PUSH // push exception handler (catchOffset int32, finallyOffset int32) OP_TRY_POP // pop exception handler (normal completion) OP_THROW // throw top-of-stack value // Specialized arithmetic/comparison opcodes (binary, stack: [a b] -> [result]) // These inline the common int64 fast path and fall back to generic NumXxx for other types. OP_ADD // + (2 args) OP_SUB // - (2 args) OP_MUL // * (2 args) OP_LT // < (2 args) OP_LTE // <= (2 args) OP_GT // > (2 args) OP_GTE // >= (2 args) OP_EQ // = (2 args) OP_INC // inc (1 arg) OP_DEC // dec (1 arg) )
Opcodes
Variables ¶
var ArrayVectorType *theArrayVectorType = &theArrayVectorType{}
ArrayVectorType is the type of ArrayVectors
var AtomType *theAtomType = &theAtomType{}
var BigIntType *theBigIntType = &theBigIntType{}
var BooleanType *theBooleanType = &theBooleanType{zero: FALSE}
BooleanType is the type of Boolean
var BoxedTypes map[string]*aBoxedType = map[string]*aBoxedType{}
BoxedType is the type of NilValues
var ChanType *theChanType = &theChanType{}
ChanType is the type of Chan
var CharType *theCharType = &theCharType{zero: utf8.RuneError}
CharType is the type of CharValues
var DelayType *theDelayType = &theDelayType{}
var EmptyPersistentMap = &PersistentMap{count: 0, root: nil}
EmptyPersistentMap is the canonical empty persistent map.
var EmptyPersistentSet = &PersistentSet{impl: EmptyPersistentMap}
EmptyPersistentSet is the canonical empty set.
var ExInfoType *theExInfoType = &theExInfoType{}
var FloatType *theFloatType = &theFloatType{zero: 0}
FloatType is the type of Float values
var FormSource = &formSourceMap{m: map[interface{}]*SourceInfo{}}
FormSource maps form values to their source locations. Used by the compiler to attach source info to bytecode. Only pointer-based types (like *List) can be tracked; slice/value types are not hashable and are silently ignored.
var FuncType *theFuncType = &theFuncType{}
var IntType *theIntType = &theIntType{zero: 0}
IntType is the type of IntValues
var IterateType *theIterateType = &theIterateType{zero: nil}
IterateType is the type of IterateValues
var KeywordType *theKeywordType = &theKeywordType{zero: "????BADKeyword????"}
KeywordType is the type of KeywordValues
var ListType *theListType = &theListType{}
ListType is the type of Lists
var MapType *theMapType = &theMapType{}
ArrayVectorType is the type of ArrayVectors
var MultiFnType *theMultiFnType = &theMultiFnType{}
var NamespaceType *theNamespaceType = &theNamespaceType{}
var NativeFnType *theNativeFnType = &theNativeFnType{}
var NilType *theNilType = &theNilType{zero: nil}
NilType is the type of NilValues
var PersistentMapType *thePersistentMapType = &thePersistentMapType{}
PersistentMapType is the type of PersistentMap values.
var PersistentVectorType *thePersistentVectorType = &thePersistentVectorType{}
PersistentVectorType is the type of PersistentVectors
var PromiseType *thePromiseType = &thePromiseType{}
var ProtocolType *theProtocolType = &theProtocolType{}
var RangeType *theRangeType = &theRangeType{}
RangeType is the type of Lists
var ReducedType *theReducedType = &theReducedType{}
var RegexType *theRegexType = &theRegexType{}
RegexType is the type of RegexValues
var RepeatType *theRepeatType = &theRepeatType{zero: nil}
RepeatType is the type of RepeatValues
var SequenceType *theSequenceType = &theSequenceType{}
SequenceType is the type of Sequences
var SetType *theSetType = &theSetType{}
ArrayVectorType is the type of ArrayVectors
var SourceRegistry = &sourceRegistry{sources: map[string]string{}}
SourceRegistry stores source text for error display. Maps file names to their full source text.
var StringType *theStringType = &theStringType{zero: ""}
StringType is the type of StringValues
var SymbolType *theSymbolType = &theSymbolType{zero: "????BADSYMBOL????"}
SymbolType is the type of Symbol values
var TransientMapType *theTransientMapType = &theTransientMapType{}
var TransientVectorType *theTransientVectorType = &theTransientVectorType{}
var TypeType *theTypeType = &theTypeType{}
var TypedArrayType *theTypedArrayType = &theTypedArrayType{}
TypedArrayType is the singleton type for all typed arrays.
var ValueEquals func(a, b Value) bool
ValueEquals performs deep structural equality comparison. Used by the = operator and OP_EQ opcode.
var VoidType *theVoidType = &theVoidType{zero: &Void{}}
VoidType is the type of VoidValues
var VolatileType *theVolatileType = &theVolatileType{}
Functions ¶
func FormatError ¶
FormatError produces a user-friendly error display with source snippets, inspired by Rust/Elm-style error reporting.
func HashValue ¶ added in v1.3.1
HashValue computes a 32-bit hash for any Value type (exported for builtins).
func OpcodeToString ¶
func ReleaseFrame ¶
func ReleaseFrame(f *Frame)
ReleaseFrame returns a frame to the pool. We don't clear stack slots — they'll be overwritten on reuse. We only nil out the large reference fields to avoid pinning code/const objects.
func SetNSLookup ¶
SetNSLookup sets the global namespace lookup function.
func SetValueEquals ¶ added in v1.2.0
SetValueEquals sets the equality function (called by rt package during init).
Types ¶
type ArrayKind ¶ added in v1.3.1
type ArrayKind int
ArrayKind discriminates the element type of a TypedArray.
type ArrayVector ¶
type ArrayVector []Value
ArrayVector is boxed singly linked list that can hold other Values.
func (ArrayVector) Arity ¶
func (l ArrayVector) Arity() int
func (ArrayVector) Assoc ¶
func (l ArrayVector) Assoc(k Value, v Value) Associative
func (ArrayVector) Conj ¶
func (l ArrayVector) Conj(val Value) Collection
func (ArrayVector) Contains ¶
func (l ArrayVector) Contains(value Value) Boolean
func (ArrayVector) Dissoc ¶
func (l ArrayVector) Dissoc(k Value) Associative
func (ArrayVector) Equals ¶
func (l ArrayVector) Equals(other Value) bool
Equals implements value equality for ArrayVector
func (ArrayVector) Hash ¶
func (l ArrayVector) Hash() uint32
Type implements Value Hash implements Hashable. Computed from elements.
func (ArrayVector) Meta ¶
func (l ArrayVector) Meta() Value
Meta implements IMeta. ArrayVector doesn't store meta, always returns NIL.
func (ArrayVector) RawCount ¶
func (l ArrayVector) RawCount() int
func (ArrayVector) Seq ¶
func (l ArrayVector) Seq() Seq
func (ArrayVector) String ¶
func (l ArrayVector) String() string
func (ArrayVector) Type ¶
func (l ArrayVector) Type() ValueType
func (ArrayVector) ValueAt ¶
func (l ArrayVector) ValueAt(key Value) Value
func (ArrayVector) WithMeta ¶
func (l ArrayVector) WithMeta(m Value) Value
WithMeta implements IMeta. Promotes to PersistentVector to carry meta.
type ArrayVectorSeq ¶
type ArrayVectorSeq struct {
// contains filtered or unexported fields
}
ArrayVectorSeq is a lightweight seq view over an ArrayVector
func (*ArrayVectorSeq) Conj ¶
func (s *ArrayVectorSeq) Conj(val Value) Collection
func (*ArrayVectorSeq) Cons ¶
func (s *ArrayVectorSeq) Cons(val Value) Seq
func (*ArrayVectorSeq) Count ¶
func (s *ArrayVectorSeq) Count() Value
func (*ArrayVectorSeq) Empty ¶
func (s *ArrayVectorSeq) Empty() Collection
func (*ArrayVectorSeq) First ¶
func (s *ArrayVectorSeq) First() Value
func (*ArrayVectorSeq) More ¶
func (s *ArrayVectorSeq) More() Seq
func (*ArrayVectorSeq) Next ¶
func (s *ArrayVectorSeq) Next() Seq
func (*ArrayVectorSeq) RawCount ¶
func (s *ArrayVectorSeq) RawCount() int
func (*ArrayVectorSeq) Seq ¶
func (s *ArrayVectorSeq) Seq() Seq
func (*ArrayVectorSeq) String ¶
func (s *ArrayVectorSeq) String() string
func (*ArrayVectorSeq) Type ¶
func (s *ArrayVectorSeq) Type() ValueType
func (*ArrayVectorSeq) Unbox ¶
func (s *ArrayVectorSeq) Unbox() interface{}
func (*ArrayVectorSeq) ValueAt ¶
func (s *ArrayVectorSeq) ValueAt(key Value) Value
ValueAt implements Lookup for ArrayVectorSeq so that `get` works on seq views.
type Associative ¶
type Associative interface {
Value
Assoc(Value, Value) Associative
Dissoc(Value) Associative
}
type Atom ¶
type Atom struct {
// contains filtered or unexported fields
}
Atom is a thread-safe mutable reference. Swap uses optimistic concurrency with a generation counter — no value comparison needed. The function may be called multiple times under contention.
func (*Atom) RemoveWatch ¶
type BigInt ¶
type BigInt struct {
// contains filtered or unexported fields
}
BigInt wraps *math/big.Int as a VM value.
func NewBigIntFromInt64 ¶
func NewBigIntFromString ¶
func (*BigInt) Hash ¶
Hash implements Hashable — consistent with Int.Hash() for values that fit in int64.
type Boxed ¶
type Boxed struct {
// contains filtered or unexported fields
}
func (*Boxed) InvokeMethod ¶
type CodeChunk ¶
type CodeChunk struct {
// contains filtered or unexported fields
}
CodeChunk holds bytecode and provides facilities for reading and writing it
func NewCodeChunk ¶
func (*CodeChunk) AddSourceInfo ¶
func (c *CodeChunk) AddSourceInfo(info SourceInfo)
AddSourceInfo records the source location for the current bytecode offset.
func (*CodeChunk) AppendChunk ¶
func (*CodeChunk) GetSourceMap ¶ added in v1.3.0
GetSourceMap returns the source map, may be nil.
func (*CodeChunk) LookupSource ¶
func (c *CodeChunk) LookupSource(ip int) *SourceInfo
LookupSource finds the source location for a given instruction pointer.
func (*CodeChunk) SetMaxStack ¶
type Collection ¶
type Collection interface {
Value
Counted
Empty() Collection
Conj(Value) Collection
}
Collection is implemented by all collections
type Cons ¶
type Cons struct {
// contains filtered or unexported fields
}
Cons is a cons cell - a pair of (first, rest) where rest is a seq. This is the fundamental building block for consing onto any seq.
func (*Cons) Conj ¶
func (c *Cons) Conj(val Value) Collection
func (*Cons) Empty ¶
func (c *Cons) Empty() Collection
type Consts ¶
type Consts struct {
// contains filtered or unexported fields
}
Consts is a constant pool with O(1) indexed access and O(1) amortized interning. Uses a custom open-addressing hash map (not Go's built-in map) so that all Value types — including slices like ArrayVector — can be interned without panicking.
Supports optional layering: a child pool references a parent. Indices 0..base-1 are in the parent, base.. are in the child. Only child entries are returned by Values() for serialization.
func NewChildConsts ¶ added in v1.3.0
NewChildConsts creates a child pool layered on top of parent. Parent values are accessible by index but not serialized with this pool.
func (*Consts) Append ¶ added in v1.3.0
Append adds a value at the next index without deduplication. Used when loading pre-compiled bytecode where indices must match the original.
func (*Consts) Intern ¶
Intern returns the index for v, adding it if not already present. Checks parent pool first (if any) to reuse existing indices.
type Delay ¶
type Delay struct {
// contains filtered or unexported fields
}
Delay wraps a thunk (zero-arg function) that is evaluated at most once. The result is cached after the first call to Force().
func (*Delay) IsRealized ¶
type ExInfo ¶
type ExInfo struct {
// contains filtered or unexported fields
}
ExInfo is an exception value carrying a message and data map. Equivalent to Clojure's ExceptionInfo.
func (*ExInfo) Data ¶
func (e *ExInfo) Data() *PersistentMap
type ExecutionError ¶
type ExecutionError struct {
// contains filtered or unexported fields
}
func NewExecutionError ¶
func NewExecutionError(m string) *ExecutionError
func (*ExecutionError) Error ¶
func (ve *ExecutionError) Error() string
func (*ExecutionError) GetCause ¶
func (ve *ExecutionError) GetCause() error
func (*ExecutionError) WithSource ¶
func (ve *ExecutionError) WithSource(info *SourceInfo) *ExecutionError
type Frame ¶
type Frame struct {
// contains filtered or unexported fields
}
Frame is a single interpreter context
func NewDebugFrame ¶
func (*Frame) RunProtected ¶
RunProtected runs the frame with panic recovery for thrownPanic. Use at top-level entry points (REPL, file eval). Internal calls use Run() directly.
type Func ¶
type Func struct {
// contains filtered or unexported fields
}
func (*Func) IsVariadic ¶ added in v1.3.0
IsVariadic returns whether the function is variadic.
func (*Func) MakeClosure ¶
type FuncInterface ¶
type FuncInterface func(interface{})
type Hashable ¶
type Hashable interface {
Hash() uint32
}
Hashable is implemented by types that cache their hash for fast map lookups.
type IMeta ¶
type IMeta interface {
Meta() Value // returns the metadata map, or NIL
WithMeta(Value) Value // returns a copy of this value with the given metadata
}
IMeta is implemented by values that support metadata.
type InfiniteRange ¶ added in v1.2.0
type InfiniteRange struct {
// contains filtered or unexported fields
}
InfiniteRange is a lazy infinite integer sequence.
func NewInfiniteRange ¶ added in v1.2.0
func NewInfiniteRange(start, step int) *InfiniteRange
func (*InfiniteRange) Cons ¶ added in v1.2.0
func (r *InfiniteRange) Cons(val Value) Seq
func (*InfiniteRange) First ¶ added in v1.2.0
func (r *InfiniteRange) First() Value
func (*InfiniteRange) More ¶ added in v1.2.0
func (r *InfiniteRange) More() Seq
func (*InfiniteRange) Next ¶ added in v1.2.0
func (r *InfiniteRange) Next() Seq
func (*InfiniteRange) Seq ¶ added in v1.2.0
func (r *InfiniteRange) Seq() Seq
func (*InfiniteRange) String ¶ added in v1.2.0
func (r *InfiniteRange) String() string
func (*InfiniteRange) Type ¶ added in v1.2.0
func (r *InfiniteRange) Type() ValueType
func (*InfiniteRange) Unbox ¶ added in v1.2.0
func (r *InfiniteRange) Unbox() interface{}
type Iterate ¶
type Iterate struct {
// contains filtered or unexported fields
}
Iterate is a Value whose only value is Iterate
func NewIterate ¶
type LazySeq ¶
type LazySeq struct {
// contains filtered or unexported fields
}
LazySeq delays computation of a sequence until first/next is called. This is the foundation for lazy operations like map, filter, etc.
func NewLazySeq ¶
func (*LazySeq) Conj ¶
func (l *LazySeq) Conj(val Value) Collection
func (*LazySeq) Empty ¶
func (l *LazySeq) Empty() Collection
type List ¶
type List struct {
// contains filtered or unexported fields
}
List is boxed singly linked list that can hold other Values.
func (*List) Conj ¶
func (l *List) Conj(value Value) Collection
type Map ¶
Map is boxed singly linked list that can hold other Values.
func (Map) Conj ¶
func (l Map) Conj(value Value) Collection
func (Map) Dissoc ¶
func (l Map) Dissoc(k Value) Associative
type MapSeq ¶
type MapSeq struct {
// contains filtered or unexported fields
}
MapSeq is a lightweight seq view over a Map's entries
func (*MapSeq) Conj ¶
func (s *MapSeq) Conj(val Value) Collection
func (*MapSeq) Empty ¶
func (s *MapSeq) Empty() Collection
type MultiArityFn ¶
type MultiArityFn struct {
// contains filtered or unexported fields
}
func (*MultiArityFn) Arity ¶
func (l *MultiArityFn) Arity() int
func (*MultiArityFn) String ¶
func (l *MultiArityFn) String() string
func (*MultiArityFn) Type ¶
func (l *MultiArityFn) Type() ValueType
type MultiFn ¶
type MultiFn struct {
// contains filtered or unexported fields
}
MultiFn implements Clojure-style multimethods. It holds a dispatch function and a map of dispatch-value → method.
func (*MultiFn) Methods ¶
func (m *MultiFn) Methods() *PersistentMap
Methods returns the method map.
func (*MultiFn) RemoveMethod ¶
RemoveMethod unregisters an implementation.
type Namespace ¶
type Namespace struct {
// contains filtered or unexported fields
}
func NewNamespace ¶
func (*Namespace) ImportVar ¶
ImportVar links a var from another namespace into this namespace under the given alias. Returns true when the var exists and is not private.
func (*Namespace) LookupLocal ¶ added in v1.3.0
LookupLocal checks only the namespace's own registry, not refers or aliases.
func (*Namespace) LookupOrAdd ¶
func (*Namespace) ReferList ¶
ReferList refers only selected symbols from the given namespace into this namespace.
func (*Namespace) RegistrySize ¶
func (*Namespace) ResolveAlias ¶
ResolveAlias returns the namespace for the given alias, or nil.
type Nil ¶
type Nil struct{}
Nil is a Value whose only value is Nil
func (*Nil) Conj ¶
func (n *Nil) Conj(value Value) Collection
func (*Nil) Dissoc ¶
func (l *Nil) Dissoc(k Value) Associative
func (*Nil) Empty ¶
func (n *Nil) Empty() Collection
type PersistentMap ¶
type PersistentMap struct {
// contains filtered or unexported fields
}
PersistentMap is an immutable hash-array mapped trie (HAMT).
func MapFromGoMap ¶
func MapFromGoMap(m map[Value]Value) *PersistentMap
MapFromGoMap converts a Go map[Value]Value to a *PersistentMap.
func NewPersistentMap ¶
func NewPersistentMap(kvs []Value) *PersistentMap
NewPersistentMap creates a PersistentMap from an alternating key-value slice.
func (*PersistentMap) Arity ¶
func (m *PersistentMap) Arity() int
func (*PersistentMap) Assoc ¶
func (m *PersistentMap) Assoc(key Value, val Value) Associative
func (*PersistentMap) Conj ¶
func (m *PersistentMap) Conj(value Value) Collection
func (*PersistentMap) Contains ¶
func (m *PersistentMap) Contains(key Value) Boolean
func (*PersistentMap) Count ¶
func (m *PersistentMap) Count() Value
func (*PersistentMap) Dissoc ¶
func (m *PersistentMap) Dissoc(key Value) Associative
func (*PersistentMap) Empty ¶
func (m *PersistentMap) Empty() Collection
func (*PersistentMap) Equals ¶
func (m *PersistentMap) Equals(other Value) bool
func (*PersistentMap) Hash ¶
func (m *PersistentMap) Hash() uint32
Hash implements Hashable. Cached after first computation. Uses unordered hashing (order-independent) since maps are unordered.
func (*PersistentMap) RawCount ¶
func (m *PersistentMap) RawCount() int
func (*PersistentMap) Seq ¶
func (m *PersistentMap) Seq() Seq
func (*PersistentMap) String ¶
func (m *PersistentMap) String() string
func (*PersistentMap) Type ¶
func (m *PersistentMap) Type() ValueType
func (*PersistentMap) Unbox ¶
func (m *PersistentMap) Unbox() interface{}
func (*PersistentMap) ValueAt ¶
func (m *PersistentMap) ValueAt(key Value) Value
func (*PersistentMap) WithMeta ¶
func (m *PersistentMap) WithMeta(meta Value) Value
WithMeta implements IMeta.
type PersistentSet ¶
type PersistentSet struct {
// contains filtered or unexported fields
}
PersistentSet is an immutable set backed by a PersistentMap. Each element is stored as a key mapping to itself (like Clojure's PersistentHashSet).
func NewPersistentSet ¶
func NewPersistentSet(vals []Value) *PersistentSet
func (*PersistentSet) Arity ¶
func (s *PersistentSet) Arity() int
func (*PersistentSet) Conj ¶
func (s *PersistentSet) Conj(value Value) Collection
func (*PersistentSet) Cons ¶
func (s *PersistentSet) Cons(val Value) Seq
func (*PersistentSet) Contains ¶
func (s *PersistentSet) Contains(value Value) Boolean
func (*PersistentSet) Count ¶
func (s *PersistentSet) Count() Value
func (*PersistentSet) Disj ¶
func (s *PersistentSet) Disj(value Value) *PersistentSet
func (*PersistentSet) Empty ¶
func (s *PersistentSet) Empty() Collection
func (*PersistentSet) First ¶
func (s *PersistentSet) First() Value
func (*PersistentSet) Hash ¶
func (s *PersistentSet) Hash() uint32
func (*PersistentSet) Meta ¶
func (s *PersistentSet) Meta() Value
func (*PersistentSet) More ¶
func (s *PersistentSet) More() Seq
func (*PersistentSet) Next ¶
func (s *PersistentSet) Next() Seq
func (*PersistentSet) RawCount ¶
func (s *PersistentSet) RawCount() int
func (*PersistentSet) Seq ¶
func (s *PersistentSet) Seq() Seq
func (*PersistentSet) String ¶
func (s *PersistentSet) String() string
func (*PersistentSet) Type ¶
func (s *PersistentSet) Type() ValueType
func (*PersistentSet) Unbox ¶
func (s *PersistentSet) Unbox() interface{}
func (*PersistentSet) WithMeta ¶
func (s *PersistentSet) WithMeta(m Value) Value
type PersistentVector ¶
type PersistentVector struct {
// contains filtered or unexported fields
}
PersistentVector is a persistent vector implementation using a bit-partitioned trie
func (PersistentVector) Assoc ¶
func (v PersistentVector) Assoc(key Value, val Value) Associative
Assoc implements Associative
func (PersistentVector) Conj ¶
func (v PersistentVector) Conj(val Value) Collection
Conj implements Collection
func (PersistentVector) Contains ¶
func (v PersistentVector) Contains(key Value) Boolean
Contains implements Associative
func (PersistentVector) Dissoc ¶
func (v PersistentVector) Dissoc(key Value) Associative
Dissoc implements Associative
func (PersistentVector) Empty ¶
func (v PersistentVector) Empty() Collection
Empty implements Collection
func (PersistentVector) Equals ¶
func (v PersistentVector) Equals(other Value) bool
Equals implements value equality for PersistentVector
func (PersistentVector) Hash ¶
func (v PersistentVector) Hash() uint32
Hash implements Hashable. Computed from elements.
func (PersistentVector) Invoke ¶
func (v PersistentVector) Invoke(args []Value) (Value, error)
Invoke implements IFn
func (PersistentVector) RawCount ¶
func (v PersistentVector) RawCount() int
func (PersistentVector) Seq ¶
func (v PersistentVector) Seq() Seq
Modify PersistentVector's Seq method:
func (PersistentVector) Unbox ¶
func (v PersistentVector) Unbox() interface{}
Unbox implements Value
func (PersistentVector) ValueAt ¶
func (v PersistentVector) ValueAt(key Value) Value
ValueAt implements Associative
func (PersistentVector) ValueAtOr ¶
func (v PersistentVector) ValueAtOr(key Value, dflt Value) Value
ValueAtOr implements Associative
func (PersistentVector) WithMeta ¶
func (v PersistentVector) WithMeta(m Value) Value
WithMeta implements IMeta.
type PersistentVectorSeq ¶
type PersistentVectorSeq struct {
// contains filtered or unexported fields
}
PersistentVectorSeq represents a sequence view of a PersistentVector
func (*PersistentVectorSeq) Conj ¶
func (s *PersistentVectorSeq) Conj(val Value) Collection
Conj implements Collection
func (*PersistentVectorSeq) Cons ¶
func (s *PersistentVectorSeq) Cons(val Value) Seq
Cons implements Seq
func (*PersistentVectorSeq) Count ¶
func (s *PersistentVectorSeq) Count() Value
Count implements Collection
func (*PersistentVectorSeq) Empty ¶
func (s *PersistentVectorSeq) Empty() Collection
Empty implements Collection
func (*PersistentVectorSeq) First ¶
func (s *PersistentVectorSeq) First() Value
First implements Seq
func (*PersistentVectorSeq) RawCount ¶
func (s *PersistentVectorSeq) RawCount() int
func (*PersistentVectorSeq) String ¶
func (s *PersistentVectorSeq) String() string
String implements Value
func (*PersistentVectorSeq) Type ¶
func (s *PersistentVectorSeq) Type() ValueType
Type implements Value
func (*PersistentVectorSeq) Unbox ¶
func (s *PersistentVectorSeq) Unbox() interface{}
Unbox implements Value
func (*PersistentVectorSeq) ValueAt ¶
func (s *PersistentVectorSeq) ValueAt(key Value) Value
ValueAt implements Lookup for PersistentVectorSeq so that `get` works on seq views.
type Promise ¶
type Promise struct {
// contains filtered or unexported fields
}
Promise is a write-once, read-many synchronization primitive. Created with (promise), written with (deliver p val), read with (deref p). Deref blocks until delivered.
func NewPromise ¶
func NewPromise() *Promise
func (*Promise) IsRealized ¶
type Protocol ¶
type Protocol struct {
// contains filtered or unexported fields
}
Protocol defines a named set of methods with type-based dispatch.
func NewProtocol ¶
func (*Protocol) Extend ¶
func (p *Protocol) Extend(vt ValueType, implMap *PersistentMap)
Extend adds implementations for a type. implMap is a PersistentMap of {method-keyword → fn}.
func (*Protocol) ExtendNil ¶
func (p *Protocol) ExtendNil(implMap *PersistentMap)
ExtendNil adds implementations for nil.
type ProtocolFn ¶
type ProtocolFn struct {
// contains filtered or unexported fields
}
ProtocolFn is a function that dispatches on the first arg's type via a protocol.
func NewProtocolFn ¶
func NewProtocolFn(protocol *Protocol, methodName Symbol) *ProtocolFn
func (*ProtocolFn) Arity ¶
func (f *ProtocolFn) Arity() int
func (*ProtocolFn) String ¶
func (f *ProtocolFn) String() string
func (*ProtocolFn) Type ¶
func (f *ProtocolFn) Type() ValueType
func (*ProtocolFn) Unbox ¶
func (f *ProtocolFn) Unbox() interface{}
type Range ¶
type Range struct {
// contains filtered or unexported fields
}
Range is a lazy integer sequence with start, end, and step.
func (*Range) Conj ¶
func (l *Range) Conj(val Value) Collection
type Record ¶
type Record struct {
// contains filtered or unexported fields
}
Record is a value created by defrecord. Fixed fields are stored in a flat array for O(1) access. Extra keys (from assoc) go into an overflow map. All map operations work — seq, keys, count include both fixed and extra fields.
func NewRecord ¶
func NewRecord(rtype *RecordType, data *PersistentMap) *Record
func ToRecord ¶
ToRecord converts a Go struct to a Record using its registered mapping. Panics if the struct type is not registered.
func (*Record) Conj ¶
func (r *Record) Conj(value Value) Collection
func (*Record) Dissoc ¶
func (r *Record) Dissoc(key Value) Associative
func (*Record) Empty ¶
func (r *Record) Empty() Collection
func (*Record) Extra ¶ added in v1.3.0
func (r *Record) Extra() *PersistentMap
Extra returns the overflow map.
func (*Record) FixedFields ¶ added in v1.3.0
FixedFields returns the fixed field values.
func (*Record) InvokeMethod ¶
func (*Record) Origin ¶
func (r *Record) Origin() interface{}
Origin returns the original Go struct if this Record was created from one, or nil.
func (*Record) RecordType ¶
func (r *Record) RecordType() *RecordType
type RecordType ¶
type RecordType struct {
// contains filtered or unexported fields
}
RecordType is a dynamically-created ValueType for a defrecord. Each defrecord call creates a unique RecordType instance.
func NewRecordType ¶
func NewRecordType(name string, fields []Keyword) *RecordType
func (*RecordType) Box ¶
func (t *RecordType) Box(bare interface{}) (Value, error)
func (*RecordType) Fields ¶
func (t *RecordType) Fields() []Keyword
func (*RecordType) Name ¶
func (t *RecordType) Name() string
func (*RecordType) String ¶
func (t *RecordType) String() string
func (*RecordType) Type ¶
func (t *RecordType) Type() ValueType
func (*RecordType) TypeName ¶ added in v1.3.0
func (rt *RecordType) TypeName() string
TypeName returns the record type name.
func (*RecordType) Unbox ¶
func (t *RecordType) Unbox() interface{}
type Reduced ¶
type Reduced struct {
// contains filtered or unexported fields
}
Reduced wraps a value to signal early termination in reduce/transduce.
func NewReduced ¶
type Regex ¶
type Regex struct {
// contains filtered or unexported fields
}
Regex is boxed int
func (*Regex) FindAllStringSubmatch ¶
func (*Regex) FindStringSubmatch ¶
type Repeat ¶
type Repeat struct {
// contains filtered or unexported fields
}
Repeat is a Value whose only value is Repeat
type Set ¶
type Set map[Value]struct{}
Set is boxed singly linked list that can hold other Values.
func (Set) Conj ¶
func (l Set) Conj(value Value) Collection
type SetSeq ¶
type SetSeq struct {
// contains filtered or unexported fields
}
SetSeq is a lightweight seq view over a Set's keys
func (*SetSeq) Conj ¶
func (s *SetSeq) Conj(val Value) Collection
func (*SetSeq) Empty ¶
func (s *SetSeq) Empty() Collection
type SetWithMeta ¶
type SetWithMeta struct {
Set
// contains filtered or unexported fields
}
SetWithMeta wraps a Set to carry metadata.
func (*SetWithMeta) Meta ¶
func (s *SetWithMeta) Meta() Value
func (*SetWithMeta) WithMeta ¶
func (s *SetWithMeta) WithMeta(m Value) Value
type SourceInfo ¶
type SourceInfo struct {
File string
Line int // 0-based
Column int // 0-based
EndLine int
EndColumn int
}
SourceInfo tracks the source location of a form.
func (*SourceInfo) String ¶
func (s *SourceInfo) String() string
type SourceMap ¶
type SourceMap struct {
// contains filtered or unexported fields
}
SourceMap maps bytecode IP offsets to source locations.
func (*SourceMap) Add ¶
func (sm *SourceMap) Add(ip int, info SourceInfo)
Add records a source location for the given instruction pointer offset.
func (*SourceMap) Entries ¶ added in v1.3.0
func (sm *SourceMap) Entries() []SourceMapEntry
Entries returns the source map entries.
func (*SourceMap) Lookup ¶
func (sm *SourceMap) Lookup(ip int) *SourceInfo
Lookup finds the SourceInfo for a given instruction pointer. Uses the last entry whose startIP <= ip.
type SourceMapEntry ¶ added in v1.3.0
type SourceMapEntry struct {
StartIP int
Info SourceInfo
}
SourceMapEntry is the exported version of sourceMapEntry.
type String ¶
type String string
String is boxed int
func (String) Conj ¶
func (l String) Conj(value Value) Collection
func (String) Empty ¶
func (l String) Empty() Collection
type StructMapping ¶
type StructMapping struct {
RecType *RecordType
GoType reflect.Type
// contains filtered or unexported fields
}
StructMapping holds the bidirectional mapping between a Go struct type and a RecordType.
func LookupStructMapping ¶
func LookupStructMapping(goType reflect.Type) *StructMapping
LookupStructMapping returns the mapping for a Go type, or nil if not registered.
func LookupStructMappingByRecord ¶
func LookupStructMappingByRecord(rt *RecordType) *StructMapping
LookupStructMappingByRecord returns the mapping for a RecordType, or nil.
func RegisterStruct ¶
func RegisterStruct[T any](name string) *StructMapping
RegisterStruct registers a Go struct type T and returns its StructMapping. Usage: mapping := vm.RegisterStruct[MyStruct]("my-ns/MyStruct")
func RegisterStructType ¶
func RegisterStructType(goType reflect.Type, name string) *StructMapping
RegisterStructType registers a Go struct type and creates a corresponding RecordType. The name parameter sets the record type name. Field names are derived from exported struct fields: use `letgo:"name"` struct tag for custom names, otherwise fields are converted from CamelCase to kebab-case (e.g. FirstName → first-name). Fields tagged `letgo:"-"` are skipped.
func (*StructMapping) RecordToStruct ¶
func (m *StructMapping) RecordToStruct(r *Record, target interface{}) error
RecordToStruct populates a Go struct from a Record's fields. If the Record has an origin of the same type, returns it directly (fast path).
func (*StructMapping) StructToRecord ¶
func (m *StructMapping) StructToRecord(v interface{}) *Record
StructToRecord converts a Go struct value to a Record. The original value is stored for fast roundtrip back to Go. Uses cached per-field converters to avoid BoxValue dispatch overhead.
type Symbol ¶
type Symbol string
Symbol is a string
func FuzzySymbolLookup ¶
func (Symbol) Namespaced ¶
type ThrownError ¶
type ThrownError struct {
Value Value // the thrown value (ExInfo or any Value)
}
ThrownError wraps a Value that was explicitly thrown. It propagates through the normal error return path.
func NewThrownError ¶
func NewThrownError(v Value) *ThrownError
func (*ThrownError) Error ¶
func (e *ThrownError) Error() string
type TransientMap ¶
type TransientMap struct {
// contains filtered or unexported fields
}
TransientMap is a mutable version of PersistentMap for batch operations. Mutations modify nodes in place instead of path-copying. Call persistent! to freeze back to an immutable PersistentMap.
func NewTransientMap ¶
func NewTransientMap(m *PersistentMap) *TransientMap
func (*TransientMap) Assoc ¶
func (t *TransientMap) Assoc(key Value, val Value) (*TransientMap, error)
Assoc mutates the transient map in place.
func (*TransientMap) Conj ¶
func (t *TransientMap) Conj(value Value) (*TransientMap, error)
Conj adds a [key val] pair.
func (*TransientMap) Count ¶
func (t *TransientMap) Count() Value
func (*TransientMap) Dissoc ¶
func (t *TransientMap) Dissoc(key Value) (*TransientMap, error)
Dissoc mutates the transient map in place.
func (*TransientMap) Persistent ¶
func (t *TransientMap) Persistent() *PersistentMap
Persistent freezes the transient and returns an immutable PersistentMap.
func (*TransientMap) RawCount ¶
func (t *TransientMap) RawCount() int
func (*TransientMap) String ¶
func (t *TransientMap) String() string
func (*TransientMap) Type ¶
func (t *TransientMap) Type() ValueType
func (*TransientMap) Unbox ¶
func (t *TransientMap) Unbox() interface{}
func (*TransientMap) ValueAt ¶
func (t *TransientMap) ValueAt(key Value) Value
ValueAt for lookups during construction.
type TransientVector ¶
type TransientVector struct {
// contains filtered or unexported fields
}
TransientVector is a mutable version of ArrayVector/PersistentVector.
func NewTransientVector ¶
func NewTransientVector(v []Value) *TransientVector
func (*TransientVector) Assoc ¶
func (t *TransientVector) Assoc(key Value, val Value) (*TransientVector, error)
Assoc sets index to value.
func (*TransientVector) Conj ¶
func (t *TransientVector) Conj(value Value) (*TransientVector, error)
Conj appends to the transient vector in place.
func (*TransientVector) Count ¶
func (t *TransientVector) Count() Value
func (*TransientVector) Persistent ¶
func (t *TransientVector) Persistent() Value
Persistent freezes the transient and returns an immutable vector.
func (*TransientVector) RawCount ¶
func (t *TransientVector) RawCount() int
func (*TransientVector) String ¶
func (t *TransientVector) String() string
func (*TransientVector) Type ¶
func (t *TransientVector) Type() ValueType
func (*TransientVector) Unbox ¶
func (t *TransientVector) Unbox() interface{}
func (*TransientVector) ValueAt ¶
func (t *TransientVector) ValueAt(key Value) Value
type TypeError ¶
type TypeError struct {
// contains filtered or unexported fields
}
TypeError is a LETGO type error which mostly happens when there is a type mismatch between either LETGO values or LETGO values and Go values. These errors print as:
TypeError: (encountered type name) ... message ... (expected type name)
func NewTypeError ¶
NewTypeError creates a new type error. This error will print the problematic value's (either interface{} or Value) type name, a message, and expected type name.
type TypedArray ¶ added in v1.3.1
type TypedArray struct {
// contains filtered or unexported fields
}
TypedArray is a mutable, typed array backed by a native Go slice. Unlike persistent collections, arrays support in-place mutation via Set.
func NewByteArray ¶ added in v1.3.1
func NewByteArray(size int) *TypedArray
func NewByteArrayFrom ¶ added in v1.3.1
func NewByteArrayFrom(data []byte) *TypedArray
func NewFloatArray ¶ added in v1.3.1
func NewFloatArray(size int) *TypedArray
func NewFloatArrayFrom ¶ added in v1.3.1
func NewFloatArrayFrom(data []float64) *TypedArray
func NewIntArray ¶ added in v1.3.1
func NewIntArray(size int) *TypedArray
func NewIntArrayFrom ¶ added in v1.3.1
func NewIntArrayFrom(data []int64) *TypedArray
func NewObjectArray ¶ added in v1.3.1
func NewObjectArray(size int) *TypedArray
func NewObjectArrayFrom ¶ added in v1.3.1
func NewObjectArrayFrom(data []Value) *TypedArray
func (*TypedArray) Arity ¶ added in v1.3.1
func (a *TypedArray) Arity() int
func (*TypedArray) Clone ¶ added in v1.3.1
func (a *TypedArray) Clone() *TypedArray
Clone returns a shallow copy.
func (*TypedArray) Conj ¶ added in v1.3.1
func (a *TypedArray) Conj(v Value) Collection
func (*TypedArray) Count ¶ added in v1.3.1
func (a *TypedArray) Count() Value
func (*TypedArray) Empty ¶ added in v1.3.1
func (a *TypedArray) Empty() Collection
func (*TypedArray) Get ¶ added in v1.3.1
func (a *TypedArray) Get(i int) Value
Get returns the element at index i as a boxed Value.
func (*TypedArray) Invoke ¶ added in v1.3.1
func (a *TypedArray) Invoke(args []Value) (Value, error)
func (*TypedArray) Kind ¶ added in v1.3.1
func (a *TypedArray) Kind() ArrayKind
Kind returns the element kind.
func (*TypedArray) Len ¶ added in v1.3.1
func (a *TypedArray) Len() int
func (*TypedArray) Meta ¶ added in v1.3.1
func (a *TypedArray) Meta() Value
Meta implements IMeta — arrays don't carry metadata.
func (*TypedArray) RawCount ¶ added in v1.3.1
func (a *TypedArray) RawCount() int
func (*TypedArray) Seq ¶ added in v1.3.1
func (a *TypedArray) Seq() Seq
func (*TypedArray) Set ¶ added in v1.3.1
func (a *TypedArray) Set(i int, v Value) error
Set sets the element at index i, coercing v to the element type.
func (*TypedArray) String ¶ added in v1.3.1
func (a *TypedArray) String() string
func (*TypedArray) Type ¶ added in v1.3.1
func (a *TypedArray) Type() ValueType
func (*TypedArray) Unbox ¶ added in v1.3.1
func (a *TypedArray) Unbox() interface{}
Unbox returns the underlying Go slice directly for interop.
func (*TypedArray) ValueAt ¶ added in v1.3.1
func (a *TypedArray) ValueAt(key Value) Value
func (*TypedArray) ValueAtOr ¶ added in v1.3.1
func (a *TypedArray) ValueAtOr(key Value, dflt Value) Value
func (*TypedArray) WithMeta ¶ added in v1.3.1
func (a *TypedArray) WithMeta(_ Value) Value
WithMeta implements IMeta — returns self (arrays don't support metadata).
type TypedArraySeq ¶ added in v1.3.1
type TypedArraySeq struct {
// contains filtered or unexported fields
}
func (*TypedArraySeq) Conj ¶ added in v1.3.1
func (s *TypedArraySeq) Conj(val Value) Collection
func (*TypedArraySeq) Cons ¶ added in v1.3.1
func (s *TypedArraySeq) Cons(val Value) Seq
func (*TypedArraySeq) Count ¶ added in v1.3.1
func (s *TypedArraySeq) Count() Value
func (*TypedArraySeq) Empty ¶ added in v1.3.1
func (s *TypedArraySeq) Empty() Collection
func (*TypedArraySeq) First ¶ added in v1.3.1
func (s *TypedArraySeq) First() Value
func (*TypedArraySeq) Meta ¶ added in v1.3.1
func (s *TypedArraySeq) Meta() Value
func (*TypedArraySeq) More ¶ added in v1.3.1
func (s *TypedArraySeq) More() Seq
func (*TypedArraySeq) Next ¶ added in v1.3.1
func (s *TypedArraySeq) Next() Seq
func (*TypedArraySeq) RawCount ¶ added in v1.3.1
func (s *TypedArraySeq) RawCount() int
func (*TypedArraySeq) Seq ¶ added in v1.3.1
func (s *TypedArraySeq) Seq() Seq
func (*TypedArraySeq) String ¶ added in v1.3.1
func (s *TypedArraySeq) String() string
func (*TypedArraySeq) Type ¶ added in v1.3.1
func (s *TypedArraySeq) Type() ValueType
func (*TypedArraySeq) Unbox ¶ added in v1.3.1
func (s *TypedArraySeq) Unbox() interface{}
func (*TypedArraySeq) ValueAt ¶ added in v1.3.1
func (s *TypedArraySeq) ValueAt(key Value) Value
func (*TypedArraySeq) ValueAtOr ¶ added in v1.3.1
func (s *TypedArraySeq) ValueAtOr(key Value, dflt Value) Value
func (*TypedArraySeq) WithMeta ¶ added in v1.3.1
func (s *TypedArraySeq) WithMeta(_ Value) Value
type Value ¶
Value is implemented by all LETGO values
func MaybeDowngrade ¶
MaybeDowngrade returns an Int if the BigInt fits in int64, otherwise BigInt.
func NewArrayVector ¶
func NewPersistentVector ¶
func NumMod ¶
NumMod computes the floored modulus (like Clojure's mod). Sign follows the divisor: (mod -10 3) => 2
type Var ¶
type Var struct {
// contains filtered or unexported fields
}
func (*Var) PopBinding ¶
func (v *Var) PopBinding()
PopBinding removes the most recent dynamic binding.
func (*Var) PushBinding ¶
PushBinding pushes a dynamic binding value.
func (*Var) SetDynamic ¶
func (v *Var) SetDynamic()
func (*Var) SetPrivate ¶
func (v *Var) SetPrivate()
type Volatile ¶
type Volatile struct {
// contains filtered or unexported fields
}
Volatile is a mutable container with no synchronization. Useful for transducers and other single-threaded mutation contexts.
func NewVolatile ¶
Source Files
¶
- atom.go
- bigint.go
- bool.go
- boxed.go
- chan.go
- char.go
- cons.go
- constpool.go
- delay.go
- equals.go
- errfmt.go
- errors.go
- exinfo.go
- float.go
- func.go
- hash.go
- int.go
- iterate.go
- keyword.go
- lazy_seq.go
- list.go
- map.go
- multifn.go
- namespace.go
- native_func.go
- nil.go
- numbers.go
- numcache.go
- persistent_map.go
- persistent_set.go
- persistent_vector.go
- promise.go
- protocol.go
- range.go
- record.go
- reduced.go
- regex.go
- repeat.go
- set.go
- source.go
- string.go
- struct_interop.go
- struct_mapping.go
- symbol.go
- transient.go
- typed_array.go
- value.go
- var.go
- vector.go
- vm.go
- void.go
- volatile.go