Documentation
¶
Index ¶
- Constants
- Variables
- func AddBaselineNamespace(ns *Namespace)
- func AllocAttrEnabled() bool
- func CloseScoped(c *Scope, timeout time.Duration)
- func ComputeSignatureForNames(names []string) (count int, hash uint64)
- func DefaultCompare(a, b Value) (int, error)
- func DumpAllocAttr(w io.Writer)
- func FormatError(err error) string
- func GuardedRootsIntact() bool
- func HashValue(v Value) uint32
- func IsBigDecimal(v Value) bool
- func IsBigInt(v Value) bool
- func IsNumber(v Value) bool
- func IsRatio(v Value) bool
- func IsReduced(v Value) bool
- func IsTruthy(v Value) bool
- func Iter(v Value) iter.Seq[Value]
- func MapEntryKV(entry Value) (Value, Value, bool)
- func NumEq(a, b Value) bool
- func NumEquivalent(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 OpcodeSetSignature() (count int, hash uint64)
- func OpcodeToString(op int32) string
- func RecordOpcode(prevOp, currOp uint8)
- func RecoverPanic(errp *error)
- func RegisterBoxedMethods(t reflect.Type, ms map[Symbol]*NativeFn)
- func ReleaseFrame(f *Frame)
- func ResetLookupStats()
- func ResetProfile()
- func SafeString(value Value) (result string, err error)
- func SeqIsEmpty(s Seq) bool
- func SeqValues(s Seq) iter.Seq[Value]
- func SetCoreNamespace(ns *Namespace)
- func SetLookupStatsEnabled(enabled bool)
- func SetNSLookup(fn func(string) *Namespace)
- func SetSuppressShadowWarn(v bool)
- 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 ToInt64(v Value) (int64, bool)
- func ToRat(v Value) (*big.Rat, bool)
- func ToStruct[T any](r *Record) (T, error)
- type ArrayChunk
- func (c *ArrayChunk) ChunkCount() int
- func (c *ArrayChunk) Count() Value
- func (c *ArrayChunk) DropFirst() IChunk
- func (c *ArrayChunk) Nth(i int) Value
- func (c *ArrayChunk) RawCount() int
- func (c *ArrayChunk) String() string
- func (c *ArrayChunk) Type() ValueType
- func (c *ArrayChunk) Unbox() any
- func (c *ArrayChunk) ValueAt(key Value) Value
- func (c *ArrayChunk) ValueAtOr(key Value, dflt Value) Value
- 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) Nth(i int) Value
- func (l ArrayVector) RawCount() int
- func (l ArrayVector) Seq() Seq
- func (l ArrayVector) SeqFrom(i int) Seq
- func (l ArrayVector) String() string
- func (l ArrayVector) Type() ValueType
- func (l ArrayVector) Unbox() any
- 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) ChunkedFirst() IChunk
- func (s *ArrayVectorSeq) ChunkedMore() Seq
- func (s *ArrayVectorSeq) ChunkedNext() Seq
- 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) Nth(i int) Value
- func (s *ArrayVectorSeq) RawCount() int
- func (s *ArrayVectorSeq) Seq() Seq
- func (s *ArrayVectorSeq) String() string
- func (s *ArrayVectorSeq) Type() ValueType
- func (s *ArrayVectorSeq) Unbox() any
- 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) CompareAndSet(oldVal, newVal Value) (bool, error)
- func (a *Atom) Deref() Value
- func (a *Atom) Hash() uint32
- func (a *Atom) Meta() Value
- func (a *Atom) RemoveWatch(key Value)
- func (a *Atom) Reset(newVal Value) (Value, error)
- func (a *Atom) String() string
- func (a *Atom) Swap(fn Fn, args []Value) (Value, error)
- func (a *Atom) Type() ValueType
- func (a *Atom) Unbox() any
- func (a *Atom) Validator() Value
- func (a *Atom) WithMeta(m Value) Value
- type BigDecimal
- func MustBigDecimalFromString(s string) *BigDecimal
- func NewBigDecimal(v *big.Float) *BigDecimal
- func NewBigDecimalFromBigInt(n *big.Int) *BigDecimal
- func NewBigDecimalFromFloat64(f float64) *BigDecimal
- func NewBigDecimalFromInt64(n int64) *BigDecimal
- func NewBigDecimalFromString(s string) (*BigDecimal, bool)
- func (b *BigDecimal) Equals(other Value) bool
- func (b *BigDecimal) GoString() string
- func (b *BigDecimal) Hash() uint32
- func (b *BigDecimal) String() string
- func (b *BigDecimal) ToFloat64() float64
- func (b *BigDecimal) Type() ValueType
- func (b *BigDecimal) Unbox() any
- func (b *BigDecimal) Val() *big.Float
- type BigInt
- type BindingSnapshot
- type BlockingDeref
- type Boolean
- type Boxed
- type Chan
- type Char
- type ChunkBuffer
- type ChunkedCons
- func (c *ChunkedCons) ChunkedFirst() IChunk
- func (c *ChunkedCons) ChunkedMore() Seq
- func (c *ChunkedCons) ChunkedNext() Seq
- func (c *ChunkedCons) Cons(val Value) Seq
- func (c *ChunkedCons) First() Value
- func (c *ChunkedCons) Hash() uint32
- func (c *ChunkedCons) More() Seq
- func (c *ChunkedCons) Next() Seq
- func (c *ChunkedCons) Seq() Seq
- func (c *ChunkedCons) String() string
- func (c *ChunkedCons) Type() ValueType
- func (c *ChunkedCons) Unbox() any
- type Closure
- type CodeChunk
- func (c *CodeChunk) AddLocalVar(slot int, name string)
- func (c *CodeChunk) AddSourceInfo(info SourceInfo)
- func (c *CodeChunk) AddSourceInfoAt(ip int, 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) LocalVars() []LocalVar
- func (c *CodeChunk) LookupSource(ip int) *SourceInfo
- func (c *CodeChunk) MaxStack() int
- func (c *CodeChunk) ReserveLocalVars(n int)
- func (c *CodeChunk) ReserveSourceMap(n int)
- func (c *CodeChunk) SetMaxStack(max int)
- func (c *CodeChunk) SetSourceMap(sm *SourceMap)
- func (c *CodeChunk) Update32(address int, value int32)
- type Collection
- type Comparator
- 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) Hash() uint32
- 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() any
- type Consts
- type Counted
- type DType
- type DTypeInstance
- func (d *DTypeInstance) DType() *DType
- func (d *DTypeInstance) Equals(other Value) bool
- func (d *DTypeInstance) Fields() []Value
- func (d *DTypeInstance) Hash() uint32
- func (d *DTypeInstance) InvokeMethod(name Symbol, args []Value) (Value, error)
- func (d *DTypeInstance) Meta() Value
- func (d *DTypeInstance) SetField(name Symbol, val Value) error
- func (d *DTypeInstance) String() string
- func (d *DTypeInstance) Type() ValueType
- func (d *DTypeInstance) Unbox() any
- func (d *DTypeInstance) WithMeta(m Value) Value
- type DefMetaPairs
- type Delay
- type ExInfo
- func (e *ExInfo) Cause() error
- func (e *ExInfo) Data() *PersistentMap
- func (e *ExInfo) Error() string
- func (e *ExInfo) InvokeMethod(name Symbol, args []Value) (Value, error)
- func (e *ExInfo) Message() string
- func (e *ExInfo) Meta() Value
- func (e *ExInfo) String() string
- func (e *ExInfo) Type() ValueType
- func (e *ExInfo) Unbox() any
- func (e *ExInfo) WithMeta(m Value) Value
- type ExceptionClass
- type ExecContext
- func (ec *ExecContext) Bind(fn Fn) Fn
- func (ec *ExecContext) BindingSnapshot() BindingSnapshot
- func (ec *ExecContext) Child() *ExecContext
- func (ec *ExecContext) Context() context.Context
- func (ec *ExecContext) Deref(v *Var) Value
- func (ec *ExecContext) Invoke(fn Fn, args []Value) (Value, error)
- func (ec *ExecContext) PopBinding(v *Var)
- func (ec *ExecContext) PrepareCall(fn Fn, arity int) *PreparedCall
- func (ec *ExecContext) PrepareCallInto(p *PreparedCall, fn Fn, arity int) bool
- func (ec *ExecContext) PushBinding(v *Var, val Value)
- func (ec *ExecContext) Scope() *Scope
- func (ec *ExecContext) SetBinding(v *Var, val Value) bool
- func (ec *ExecContext) SetScope(s *Scope)
- type ExecutionError
- type Float
- type Float32
- 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) Meta() Value
- func (l *Func) SetName(n string)
- func (l *Func) String() string
- func (l *Func) Type() ValueType
- func (l *Func) Unbox() any
- func (l *Func) WithMeta(m Value) Value
- type FuncInterface
- type GoPanicError
- type Hashable
- type IChunk
- type IChunkedSeq
- type IMeta
- type Indexed
- type InfiniteRange
- func (r *InfiniteRange) ChunkedFirst() IChunk
- func (r *InfiniteRange) ChunkedMore() Seq
- func (r *InfiniteRange) ChunkedNext() Seq
- 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() any
- type Instant
- 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) InvokeMethod(name Symbol, args []Value) (Value, error)
- func (l Keyword) Name() Value
- func (l Keyword) Namespace() Value
- func (l Keyword) Namespaced() (Value, Value)
- func (l Keyword) NamespacedRaw() (ns Keyword, name Keyword, hasNS bool)
- func (l Keyword) String() string
- func (l Keyword) Type() ValueType
- func (l Keyword) Unbox() any
- type KeywordLookup
- 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) Hash() uint32
- func (l *LazySeq) IsRealized() bool
- 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() any
- 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() any
- func (l *List) ValueAt(key Value) Value
- func (l *List) ValueAtOr(key Value, dflt Value) Value
- func (l *List) WithMeta(m Value) Value
- type LocalVar
- type Lookup
- type LookupStats
- 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() any
- func (l Map) ValueAt(key Value) Value
- func (l Map) ValueAtOr(key Value, dflt Value) Value
- type MapEntry
- func (e MapEntry) Conj(v Value) Collection
- func (e MapEntry) Cons(v Value) Seq
- func (e MapEntry) Contains(k Value) Boolean
- func (e MapEntry) Count() Value
- func (e MapEntry) Empty() Collection
- func (e MapEntry) Equals(other Value) bool
- func (e MapEntry) First() Value
- func (e MapEntry) Hash() uint32
- func (e MapEntry) More() Seq
- func (e MapEntry) Next() Seq
- func (e MapEntry) RawCount() int
- func (e MapEntry) Seq() Seq
- func (e MapEntry) String() string
- func (e MapEntry) Type() ValueType
- func (e MapEntry) Unbox() any
- func (e MapEntry) ValueAt(k Value) Value
- func (e MapEntry) ValueAtOr(k Value, dflt Value) Value
- 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() any
- type MetaFn
- type MetaValue
- func (m *MetaValue[T]) InvokeMethod(name Symbol, args []Value) (Value, error)
- func (m *MetaValue[T]) Meta() Value
- func (m *MetaValue[T]) String() string
- func (m *MetaValue[T]) Type() ValueType
- func (m *MetaValue[T]) Unbox() any
- func (m *MetaValue[T]) WithMeta(v Value) Value
- func (m *MetaValue[T]) Wrapped() T
- type MultiArityFn
- func (l *MultiArityFn) Arity() int
- func (l *MultiArityFn) Invoke(pargs []Value) (Value, error)
- func (l *MultiArityFn) MakeClosure() Fn
- func (l *MultiArityFn) Meta() Value
- func (l *MultiArityFn) String() string
- func (l *MultiArityFn) Type() ValueType
- func (l *MultiArityFn) Unbox() any
- func (l *MultiArityFn) WithMeta(m Value) Value
- type MultiFn
- func (m *MultiFn) AddMethod(dispatchVal Value, method Fn) *MultiFn
- func (m *MultiFn) Arity() int
- func (m *MultiFn) FreezeNative()
- func (m *MultiFn) GetMethod(dv Value) Value
- func (m *MultiFn) Invoke(args []Value) (Value, error)
- func (m *MultiFn) IsNativeFrozen() bool
- func (m *MultiFn) Meta() Value
- 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() any
- func (m *MultiFn) WithMeta(meta Value) Value
- type Named
- type Namespace
- func (n *Namespace) Alias(alias Symbol, target *Namespace)
- func (n *Namespace) AliasesSnapshot() map[Symbol]*Namespace
- func (n *Namespace) AllVars() map[Symbol]*Var
- func (n *Namespace) AlterMeta(f func(Value) (Value, error)) error
- func (n *Namespace) Def(name string, val Value) *Var
- func (n *Namespace) DefStub(name string) *Var
- func (n *Namespace) Exclude(name string)
- func (n *Namespace) ImportVar(from *Namespace, name Symbol, alias Symbol) bool
- func (n *Namespace) IsExcluded(name Symbol) bool
- func (n *Namespace) Lookup(symbol Symbol) Value
- func (n *Namespace) LookupIncludingPrivate(symbol Symbol) Value
- func (n *Namespace) LookupLocal(symbol Symbol) *Var
- func (n *Namespace) LookupOrAdd(symbol Symbol) Value
- func (n *Namespace) Meta() Value
- func (n *Namespace) Name() string
- func (n *Namespace) PublicVars() map[Symbol]*Var
- func (n *Namespace) Refer(ns *Namespace, alias string, all bool)
- func (n *Namespace) ReferList(ns *Namespace, symbols []Symbol)
- func (n *Namespace) ReferredVars() map[Symbol]*Var
- 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() any
- func (n *Namespace) Unmap(name Symbol)
- type NativeFn
- func (l *NativeFn) Arity() int
- func (l *NativeFn) HasCtx() bool
- func (l *NativeFn) Invoke(args []Value) (ret Value, err error)
- func (l *NativeFn) IsVariadic() bool
- func (l *NativeFn) Meta() Value
- func (l *NativeFn) SetName(n string)
- func (l *NativeFn) String() string
- func (l *NativeFn) Type() ValueType
- func (l *NativeFn) Unbox() any
- func (l *NativeFn) WithArity(arity int, variadric bool) *NativeFn
- func (l *NativeFn) WithMeta(m Value) Value
- type Nil
- func (n *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 (n *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() any
- type PairSample
- 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() any
- func (m *PersistentMap) ValueAt(key Value) Value
- func (m *PersistentMap) ValueAtKeyword(k Keyword) Value
- func (m *PersistentMap) ValueAtKeywordOr(k Keyword, dflt Value) Value
- func (m *PersistentMap) ValueAtOr(key Value, dflt Value) Value
- func (m *PersistentMap) WithMeta(meta Value) Value
- type PersistentQueue
- func (q *PersistentQueue) Conj(value Value) Collection
- func (q *PersistentQueue) Count() Value
- func (q *PersistentQueue) Empty() Collection
- func (q *PersistentQueue) Equals(other Value) bool
- func (q *PersistentQueue) Hash() uint32
- func (q *PersistentQueue) Meta() Value
- func (q *PersistentQueue) Peek() Value
- func (q *PersistentQueue) Pop() *PersistentQueue
- func (q *PersistentQueue) RawCount() int
- func (q *PersistentQueue) Seq() Seq
- func (q *PersistentQueue) String() string
- func (q *PersistentQueue) Type() ValueType
- func (q *PersistentQueue) Unbox() any
- func (q *PersistentQueue) WithMeta(m 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() any
- func (s *PersistentSet) ValueAt(key Value) Value
- func (s *PersistentSet) ValueAtOr(key Value, dflt Value) Value
- 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) IdentityKey() uintptr
- func (v PersistentVector) Invoke(args []Value) (Value, error)
- func (v PersistentVector) Meta() Value
- func (v PersistentVector) Nth(i int) Value
- func (v PersistentVector) Pop() PersistentVector
- func (v PersistentVector) RawCount() int
- func (v PersistentVector) SameIdentity(other PersistentVector) bool
- func (v PersistentVector) Seq() Seq
- func (v PersistentVector) String() string
- func (v PersistentVector) Type() ValueType
- func (v PersistentVector) Unbox() any
- 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) ChunkedFirst() IChunk
- func (s *PersistentVectorSeq) ChunkedMore() Seq
- func (s *PersistentVectorSeq) ChunkedNext() Seq
- 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) Nth(i int) Value
- func (s *PersistentVectorSeq) RawCount() int
- func (s *PersistentVectorSeq) String() string
- func (s *PersistentVectorSeq) Type() ValueType
- func (s *PersistentVectorSeq) Unbox() any
- func (s *PersistentVectorSeq) ValueAt(key Value) Value
- func (s *PersistentVectorSeq) ValueAtOr(key Value, dflt Value) Value
- type PreparedCall
- type ProfileSample
- type Promise
- type Protocol
- func (p *Protocol) Extend(vt ValueType, implMap *PersistentMap)
- func (p *Protocol) ExtendNil(implMap *PersistentMap)
- func (p *Protocol) ExtendViaUnion(vt ValueType, implMap *PersistentMap)
- func (p *Protocol) Lookup(methodName Symbol, target Value) (Fn, bool)
- func (p *Protocol) Meta() Value
- 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() any
- func (p *Protocol) WithMeta(m Value) Value
- type ProtocolFn
- type Range
- func (l *Range) Bounds() (start, end, step int)
- func (l *Range) ChunkedFirst() IChunk
- func (l *Range) ChunkedMore() Seq
- func (l *Range) ChunkedNext() Seq
- 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) Nth(i int) Value
- func (l *Range) RawCount() int
- func (l *Range) Seq() Seq
- func (l *Range) String() string
- func (l *Range) Type() ValueType
- func (l *Range) Unbox() any
- func (l *Range) ValueAt(key Value) Value
- func (l *Range) ValueAtOr(key Value, dflt Value) Value
- type Ratio
- 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() any
- 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() any
- func (r *Record) ValueAt(key Value) Value
- func (r *Record) ValueAtKeyword(k Keyword) Value
- func (r *Record) ValueAtKeywordOr(k Keyword, notFound Value) Value
- func (r *Record) ValueAtOr(key Value, notFound Value) Value
- func (r *Record) WithMeta(m Value) Value
- type RecordBase
- 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) FindAllStringSubmatchIndex(s string, n int) [][]int
- func (l *Regex) FindStringSubmatch(s string) []string
- func (l *Regex) FindStringSubmatchIndex(s string) []int
- func (l *Regex) Pattern() string
- func (l *Regex) ReplaceAll(s string, replacement string) (string, error)
- func (l *Regex) ReplaceAllFunc(s string, f func(groups []string, present []bool) (string, error)) (string, error)
- func (l *Regex) ReplaceFirst(s string, replacement string) (string, error)
- func (l *Regex) ReplaceFirstFunc(s string, f func(groups []string, present []bool) (string, error)) (string, error)
- func (l *Regex) Split(s string, n int) []string
- func (l *Regex) String() string
- func (l *Regex) Type() ValueType
- func (l *Regex) Unbox() any
- 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() any
- type Scope
- func (s *Scope) Await(timeout time.Duration) bool
- func (s *Scope) Cancel()
- func (s *Scope) CancelAll()
- func (s *Scope) Child() *Scope
- func (s *Scope) Context() context.Context
- func (s *Scope) Drain(timeout time.Duration) bool
- func (s *Scope) Go(fn func(ctx context.Context))
- func (s *Scope) Live() int
- func (s *Scope) LiveTree() int
- func (s *Scope) Shutdown(timeout time.Duration) bool
- func (s *Scope) String() string
- func (s *Scope) Type() ValueType
- func (s *Scope) Unbox() any
- 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() any
- 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() any
- type SetWithMeta
- type SortedMap
- func (m *SortedMap) Arity() int
- func (m *SortedMap) Assoc(key, val Value) Associative
- func (m *SortedMap) Conj(value Value) Collection
- func (m *SortedMap) Contains(key Value) Boolean
- func (m *SortedMap) Count() Value
- func (m *SortedMap) Dissoc(key Value) Associative
- func (m *SortedMap) Empty() Collection
- func (m *SortedMap) Hash() uint32
- func (m *SortedMap) Invoke(args []Value) (Value, error)
- func (m *SortedMap) Meta() Value
- func (m *SortedMap) RSeq() Seq
- func (m *SortedMap) RawCount() int
- func (m *SortedMap) Seq() Seq
- func (m *SortedMap) String() string
- func (m *SortedMap) Type() ValueType
- func (m *SortedMap) Unbox() any
- func (m *SortedMap) ValueAt(key Value) Value
- func (m *SortedMap) ValueAtOr(key, dflt Value) Value
- func (m *SortedMap) WithMeta(meta Value) Value
- type SortedMapSeq
- func (s *SortedMapSeq) Cons(val Value) Seq
- func (s *SortedMapSeq) Count() Value
- func (s *SortedMapSeq) First() Value
- func (s *SortedMapSeq) More() Seq
- func (s *SortedMapSeq) Next() Seq
- func (s *SortedMapSeq) RawCount() int
- func (s *SortedMapSeq) String() string
- func (s *SortedMapSeq) Type() ValueType
- func (s *SortedMapSeq) Unbox() any
- type SortedSet
- func (s *SortedSet) Arity() int
- func (s *SortedSet) Conj(value Value) Collection
- func (s *SortedSet) Cons(val Value) Seq
- func (s *SortedSet) Contains(value Value) Boolean
- func (s *SortedSet) Count() Value
- func (s *SortedSet) Disj(value Value) *SortedSet
- func (s *SortedSet) Empty() Collection
- func (s *SortedSet) First() Value
- func (s *SortedSet) Hash() uint32
- func (s *SortedSet) Invoke(pargs []Value) (Value, error)
- func (s *SortedSet) Meta() Value
- func (s *SortedSet) More() Seq
- func (s *SortedSet) Next() Seq
- func (s *SortedSet) RSeq() Seq
- func (s *SortedSet) RawCount() int
- func (s *SortedSet) Seq() Seq
- func (s *SortedSet) String() string
- func (s *SortedSet) Type() ValueType
- func (s *SortedSet) Unbox() any
- func (s *SortedSet) ValueAt(key Value) Value
- func (s *SortedSet) ValueAtOr(key Value, dflt Value) Value
- func (s *SortedSet) WithMeta(m Value) Value
- type SortedSetSeq
- func (s *SortedSetSeq) Cons(val Value) Seq
- func (s *SortedSetSeq) Count() Value
- func (s *SortedSetSeq) First() Value
- func (s *SortedSetSeq) More() Seq
- func (s *SortedSetSeq) Next() Seq
- func (s *SortedSetSeq) RawCount() int
- func (s *SortedSetSeq) String() string
- func (s *SortedSetSeq) Type() ValueType
- func (s *SortedSetSeq) Unbox() any
- 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) InvokeMethod(name Symbol, args []Value) (Value, error)
- func (l String) More() Seq
- func (l String) Next() Seq
- func (l String) Nth(i int) Value
- func (l String) RawCount() int
- func (l String) Seq() Seq
- func (l String) String() string
- func (l String) Type() ValueType
- func (l String) Unbox() any
- func (l String) ValueAt(key Value) Value
- func (l String) ValueAtOr(key Value, dflt Value) Value
- type StructMapping
- type Symbol
- func (l Symbol) Arity() int
- func (l Symbol) Hash() uint32
- func (l Symbol) Invoke(pargs []Value) (Value, error)
- func (l Symbol) Name() Value
- func (l Symbol) Namespace() Value
- func (l Symbol) Namespaced() (Value, Value)
- func (l Symbol) NamespacedRaw() (ns Symbol, name Symbol, hasNS bool)
- func (l Symbol) String() string
- func (l Symbol) Type() ValueType
- func (l Symbol) Unbox() any
- type ThrownError
- type TransientMap
- func (t *TransientMap) Arity() int
- func (t *TransientMap) Assoc(key Value, val Value) (*TransientMap, error)
- func (t *TransientMap) Conj(value Value) (*TransientMap, error)
- func (t *TransientMap) Contains(key Value) Boolean
- func (t *TransientMap) Count() Value
- func (t *TransientMap) Dissoc(key Value) (*TransientMap, error)
- func (t *TransientMap) Invoke(args []Value) (Value, error)
- func (t *TransientMap) Persistent() (*PersistentMap, error)
- func (t *TransientMap) RawCount() int
- func (t *TransientMap) Seq() Seq
- func (t *TransientMap) String() string
- func (t *TransientMap) Type() ValueType
- func (t *TransientMap) Unbox() any
- func (t *TransientMap) ValueAt(key Value) Value
- func (t *TransientMap) ValueAtOr(key Value, notFound Value) Value
- type TransientSet
- func (t *TransientSet) Arity() int
- func (t *TransientSet) Conj(value Value) (*TransientSet, error)
- func (t *TransientSet) Contains(key Value) Boolean
- func (t *TransientSet) Count() Value
- func (t *TransientSet) Disj(value Value) (*TransientSet, error)
- func (t *TransientSet) Invoke(args []Value) (Value, error)
- func (t *TransientSet) Persistent() (*PersistentSet, error)
- func (t *TransientSet) RawCount() int
- func (t *TransientSet) String() string
- func (t *TransientSet) Type() ValueType
- func (t *TransientSet) Unbox() any
- func (t *TransientSet) ValueAt(key Value) Value
- func (t *TransientSet) ValueAtOr(key Value, notFound Value) Value
- type TransientVector
- func (t *TransientVector) Arity() int
- func (t *TransientVector) Assoc(key Value, val Value) (*TransientVector, error)
- func (t *TransientVector) Conj(value Value) (*TransientVector, error)
- func (t *TransientVector) Contains(key Value) Boolean
- func (t *TransientVector) Count() Value
- func (t *TransientVector) Invoke(args []Value) (Value, error)
- func (t *TransientVector) Nth(i int) Value
- func (t *TransientVector) Persistent() (Value, error)
- func (t *TransientVector) Pop() (*TransientVector, error)
- func (t *TransientVector) RawCount() int
- func (t *TransientVector) String() string
- func (t *TransientVector) Type() ValueType
- func (t *TransientVector) Unbox() any
- func (t *TransientVector) ValueAt(key Value) Value
- func (t *TransientVector) ValueAtOr(key Value, notFound Value) Value
- type TypeError
- type TypeUnion
- 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) Nth(i int) 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() any
- 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) Nth(i int) Value
- func (s *TypedArraySeq) RawCount() int
- func (s *TypedArraySeq) Seq() Seq
- func (s *TypedArraySeq) String() string
- func (s *TypedArraySeq) Type() ValueType
- func (s *TypedArraySeq) Unbox() any
- func (s *TypedArraySeq) ValueAt(key Value) Value
- func (s *TypedArraySeq) ValueAtOr(key Value, dflt Value) Value
- func (s *TypedArraySeq) WithMeta(_ Value) Value
- type UUID
- type Value
- func BoxValue(v reflect.Value) (Value, error)
- func ErrorToValue(err error) Value
- func MakeFloat(v float64) Value
- func MakeInt(v int) Value
- func MakeInt64(v int64) Value
- func MaybeDowngrade(b *big.Int) Value
- func MaybeSimplifyRatio(r *big.Rat) Value
- func MustBox(v any) 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 NumAddP(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 NumMulP(a, b Value) (Value, error)
- func NumNeg(a Value) (Value, error)
- func NumNegP(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 NumSubP(a, b Value) (Value, error)
- func NumUncheckedAdd(a, b Value) (Value, error)
- func NumUncheckedMultiply(a, b Value) (Value, error)
- func NumUncheckedSubtract(a, b Value) (Value, error)
- func RunWithBindings(snap BindingSnapshot, fn func() (Value, error)) (Value, error)
- func SeqToSlice(v Value) ([]Value, error)
- func ToLetGo(v any) (Value, error)
- type ValueType
- type Var
- func (v *Var) AddWatch(key Value, fn Fn)
- func (v *Var) AlterMeta(fn Fn, args []Value) (Value, error)
- func (v *Var) AlterRoot(fn Fn) (Value, error)
- func (v *Var) AlterRootArgs(fn Fn, args []Value) (Value, error)
- func (v *Var) Arity() int
- func (v *Var) Deref() Value
- func (v *Var) GuardDeviated() bool
- func (v *Var) GuardRoot()
- func (v *Var) Invoke(values []Value) (Value, error)
- func (v *Var) IsBound() bool
- func (v *Var) IsDynamic() bool
- func (v *Var) IsMacro() bool
- func (v *Var) IsPrivate() bool
- func (v *Var) Meta() Value
- func (v *Var) MetaDeferred() bool
- func (v *Var) NS() string
- func (v *Var) NSRef() *Namespace
- func (v *Var) PopBinding()
- func (v *Var) PushBinding(val Value)
- func (v *Var) RemoveWatch(key Value)
- func (v *Var) Root() Value
- func (v *Var) SetDynamic()
- func (v *Var) SetMacro()
- func (v *Var) SetMeta(meta Value)
- func (v *Var) SetMetaPairs(meta Value)
- 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() any
- func (v *Var) VarName() string
- type Void
- type Volatile
Constants ¶
const ( TraceVarNS = "core" TraceVarName = "*lg-trace*" )
TraceVarNS and TraceVarName identify the tracing control var, defined in the core namespace as `(def ^:dynamic *lg-trace* false)`. Both are matched so a user-namespace var that happens to be named *lg-trace* cannot hijack the gate.
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_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_BIT_AND OP_BIT_OR OP_BIT_XOR OP_BIT_AND_NOT OP_BIT_SHIFT_LEFT OP_BIT_SHIFT_RIGHT OP_UNSIGNED_BIT_SHIFT_RIGHT 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) OP_BIT_NOT OP_QUOT // quot — integer quotient, truncated toward zero (2 args) OP_DIV // / — true division; int/int yields a Ratio (or Int when exact), any float yields Float (2 args) OP_UNCHECKED_ADD // unchecked-add — Int + Int wrapping at the platform width, never promoted (2 args) OP_UNCHECKED_SUB // unchecked-subtract — Int - Int wrapping at the platform width, never promoted (2 args) OP_UNCHECKED_MUL // unchecked-multiply — Int * Int wrapping at the platform width, never promoted (2 args) OP_FINALLY_END // end of a finally block (finallyOffset int32, negative): rethrow the pending error after an abnormal entry OP_COUNT // sentinel — keep last; must equal len(opcodeNames) (enforced at init) )
Opcodes
const BigDecimalPrecConst = bigDecimalPrec
Variables ¶
var ( ClassThrowable = newExceptionClass("java.lang.Throwable", nil) ClassError = newExceptionClass("java.lang.Error", ClassThrowable) ClassAssertionError = newExceptionClass("java.lang.AssertionError", ClassError) ClassException = newExceptionClass("java.lang.Exception", ClassThrowable) ClassIOException = newExceptionClass("java.io.IOException", ClassException) ClassInterruptedException = newExceptionClass("java.lang.InterruptedException", ClassException) ClassRuntimeException = newExceptionClass("java.lang.RuntimeException", ClassException) ClassArithmeticException = newExceptionClass("java.lang.ArithmeticException", ClassRuntimeException) ClassClassCastException = newExceptionClass("java.lang.ClassCastException", ClassRuntimeException) ClassIllegalArgument = newExceptionClass("java.lang.IllegalArgumentException", ClassRuntimeException) ClassNumberFormat = newExceptionClass("java.lang.NumberFormatException", ClassIllegalArgument) ClassIllegalState = newExceptionClass("java.lang.IllegalStateException", ClassRuntimeException) ClassIndexOutOfBounds = newExceptionClass("java.lang.IndexOutOfBoundsException", ClassRuntimeException) ClassNullPointer = newExceptionClass("java.lang.NullPointerException", ClassRuntimeException) ClassUnsupportedOperation = newExceptionClass("java.lang.UnsupportedOperationException", ClassRuntimeException) )
var ( IFnProtocol *Protocol IFnInvoke Fn // IDerefProtocol / IDerefDeref wire "derefable values": any value whose type // satisfies IDeref can be used with @ / deref, dispatched to its -deref // method. Set once by the runtime after core defines the IDeref protocol. IDerefProtocol *Protocol IDerefDeref Fn )
IFnProtocol and IFnInvoke wire up "invokable values": any value whose type satisfies IFnProtocol can be called like a function, with the call dispatched to its -invoke method (the IFnInvoke protocol fn). They are set once by the runtime after core defines the IFn protocol; until then invoking a non-Fn value is a plain type error, as before.
var AnyType *theAnyType = &theAnyType{}
var ArrayVectorType *theArrayVectorType = &theArrayVectorType{}
ArrayVectorType is the type of ArrayVectors
var AtomType *theAtomType = &theAtomType{}
var BigDecimalType *theBigDecimalType = &theBigDecimalType{}
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. Guarded by boxedTypesMu: boxing values from multiple goroutines (e.g. parallel lowering) otherwise races on this shared map, which is a runtime panic for concurrent writes, not just a detector warning.
var ChanType *theChanType = &theChanType{}
ChanType is the type of Chan
var CharType *theCharType = &theCharType{zero: utf8.RuneError}
CharType is the type of CharValues
var ComparableFallback func(a, b Value) (int, bool, error)
ComparableFallback, when set, is consulted by DefaultCompare for values it cannot order natively. It dispatches on a's type only (mirroring Clojure's compare, which calls a.compareTo(b)) and returns (result, handled, err): handled is false when a's type has no Comparable implementation, in which case DefaultCompare reports its usual error. The runtime (package rt) wires this at init to route through the Comparable protocol; it lives here as a hook to avoid a vm->rt import cycle. Because compare, sort, and sorted-set all funnel through DefaultCompare, registering once makes all three respect Comparable — matching Clojure, where sort/sorted-set use compare.
var DelayType *theDelayType = &theDelayType{}
var EmptyPersistentMap = &PersistentMap{count: 0, root: nil}
EmptyPersistentMap is the canonical empty persistent map.
var EmptyPersistentSet = &PersistentSet{impl: emptySetImpl}
EmptyPersistentSet is the canonical empty set.
var EmptySortedMap = &SortedMap{cmp: DefaultCompare}
var EmptySortedSet = &SortedSet{impl: EmptySortedMap}
var ExInfoType *theExInfoType = &theExInfoType{}
var ExceptionClasses []*ExceptionClass
ExceptionClasses lists every canonical class in registration order so pkg/rt can Def names and constructors by iteration.
var FloatType *theFloatType = &theFloatType{zero: 0}
FloatType is the type of Float values
var FormSource = &formSourceMap{m: map[any]*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 Goroutines = newRootScope()
Goroutines is the process-wide root scope. Every VM spawn goes through a scope; blocking ops consult its Context for cancellation.
var InstantType *theInstantType = &theInstantType{}
InstantType is the type of Instant values.
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 ProfilingEnabled atomic.Bool
ProfilingEnabled gates the per-opcode increments in Frame.Run. Read on every opcode dispatch when true; a single atomic Load.
var PromiseType *thePromiseType = &thePromiseType{}
var ProtocolType *theProtocolType = &theProtocolType{}
var QueueType *theQueueType = &theQueueType{}
QueueType is the type of PersistentQueues.
var RangeType *theRangeType = &theRangeType{}
RangeType is the type of Lists
var RatioType *theRatioType = &theRatioType{}
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 RootExecContext = &ExecContext{bindings: globalBindingStack}
RootExecContext is the always-available default context. Frames with no more specific context resolve against it.
var ScopeType *theScopeType = &theScopeType{}
ScopeType is the Value type of a Scope handle.
var SequenceType *theSequenceType = &theSequenceType{}
SequenceType is the type of Sequences
var SetType *theSetType = &theSetType{}
ArrayVectorType is the type of ArrayVectors
var SortedMapType *theSortedMapType = &theSortedMapType{}
var SortedSetType *theSortedSetType = &theSortedSetType{}
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 TraceArmed atomic.Bool
TraceArmed is the coarse gate read once per frame entry in Frame.Run. It is flipped true the first time *lg-trace* is bound or set to a truthy value (see pushBinding and OP_SET_VAR). Once armed it stays armed for the process lifetime; a frame only actually traces when the precise per-frame Deref of TraceVar is also truthy, so disarming is unnecessary (an unbound/false *lg-trace* simply produces no trace).
var TraceVar atomic.Pointer[Var]
TraceVar is the interned core `*lg-trace*` var, letting the VM — which cannot import pkg/rt — resolve the var's current dynamic value against a frame's ExecContext. It self-wires the first time *lg-trace* is bound or set truthy (armTraceIfTruthy), so no rt-side core-load hook is needed; nil until then, in which case tracing is inert.
var TransientMapType *theTransientMapType = &theTransientMapType{}
var TransientSetType *theTransientSetType = &theTransientSetType{}
var TransientVectorType *theTransientVectorType = &theTransientVectorType{}
var TypeType *theTypeType = &theTypeType{}
var TypedArrayType *theTypedArrayType = &theTypedArrayType{}
TypedArrayType is the singleton type for all typed arrays.
var UUIDType *theUUIDType = &theUUIDType{}
UUIDType is the type of UUID values
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 AddBaselineNamespace ¶ added in v1.12.0
func AddBaselineNamespace(ns *Namespace)
AddBaselineNamespace registers ns as an auto-refer'd resolution baseline.
func AllocAttrEnabled ¶ added in v1.12.0
func AllocAttrEnabled() bool
AllocAttrEnabled reports whether .lg allocation attribution is on. Used by rt to serialize pmapv workers so the shadow stack is coherent.
func CloseScoped ¶ added in v1.9.0
CloseScoped tears a with-scope child down: cancel the subtree, drain up to timeout (warn on a straggler), restore the caller's previous current scope via the restore closure OpenChildEC installed, and unparent the child so it is not retained.
func ComputeSignatureForNames ¶ added in v1.12.0
ComputeSignatureForNames computes an opcode-set signature for a given list of opcode names. Used by the bytecode migration system to compute signatures for older opcode sets.
func DefaultCompare ¶ added in v1.5.0
DefaultCompare is the default comparator used by sorted collections. It handles nil, numbers, strings, keywords, symbols, booleans, and chars.
func DumpAllocAttr ¶ added in v1.12.0
DumpAllocAttr writes the attribution report: per-kind totals, then the top call-stack keys by bytes.
func FormatError ¶
FormatError produces a user-friendly error display with source snippets, inspired by Rust/Elm-style error reporting.
func GuardedRootsIntact ¶ added in v1.12.0
func GuardedRootsIntact() bool
GuardedRootsIntact reports that no guarded native-primitive var root is currently overridden. One atomic load — cheap enough for emitted per-call guards in the lowered tree.
func HashValue ¶ added in v1.3.1
HashValue computes a 32-bit hash for any Value type (exported for builtins).
func IsBigDecimal ¶ added in v1.5.0
IsBigDecimal returns true if v is a *BigDecimal.
func Iter ¶ added in v1.8.0
Iter returns a Go-1.23+ iter.Seq[Value] over any let-go sequence value. Yields nothing if v is nil/NIL or isn't a sequence.
Preserves laziness: the underlying LazySeq thunks are realized one step at a time as the consumer pulls values, and an early break stops realization.
Idiomatic use:
for v := range vm.Iter(result) {
// process v
}
Composes with slices.Collect, slices.Filter, etc.
func NumEq ¶
NumEq tests Clojure = numeric equality. Exact integers compare across fixed/big integer representations, floating values compare by value, and BigDecimal only compares with BigDecimal.
func NumEquivalent ¶ added in v1.8.0
NumEquivalent tests broad numeric equivalence for == and numeric predicates.
func OpcodeSetSignature ¶ added in v1.12.0
OpcodeSetSignature identifies this VM's opcode set: the opcode count and an FNV-64a hash of the mnemonics joined in enum order. Bytecode bundles embed it at encode time (bytecode.CapOpcodeSet) so a decoder on a VM with a different opcode enum — opcodes inserted, removed, or reordered — can reject the bundle instead of executing shifted opcodes.
func OpcodeToString ¶
func RecordOpcode ¶ added in v1.9.0
func RecordOpcode(prevOp, currOp uint8)
RecordOpcode is called from Frame.Run on every dispatch when ProfilingEnabled is true. prevOp is the previous opcode byte (or 0 at frame start).
func RecoverPanic ¶ added in v1.12.0
func RecoverPanic(errp *error)
RecoverPanic catches a thrownPanic and converts it back to an error return. It also catches arbitrary Go panics and converts them to ExecutionErrors so that they produce let-go errors instead of crashing with Go stack traces. Call directly as a deferred function: defer RecoverPanic(&err).
func RegisterBoxedMethods ¶ added in v1.13.0
RegisterBoxedMethods is a no-op on reflect-capable builds: the full method table comes from reflection. The TinyGo build (boxed_reflect_tinygo.go) consults this registry because reflect.Type.Method is unimplemented there.
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 ResetLookupStats ¶ added in v1.11.1
func ResetLookupStats()
func SafeString ¶ added in v1.12.0
SafeString renders a value across the same panic-to-error boundary used by VM invocation. Printing can realize lazy values, so top-level callers must not call Value.String directly.
func SeqIsEmpty ¶ added in v1.8.0
SeqIsEmpty reports whether a Seq is exhausted. Encapsulates the two sentinels — Go nil and the EmptyList singleton — that let-go uses interchangeably to signal end-of-sequence.
Use this to avoid the common `for s != nil && s != EmptyList` pattern.
func SeqValues ¶ added in v1.8.0
SeqValues returns an iter.Seq[Value] that walks a Seq from a known Seq starting point. Use when you already have a Seq; use Iter when you have a Value (which may be Sequable or non-seq).
func SetCoreNamespace ¶ added in v1.8.0
func SetCoreNamespace(ns *Namespace)
SetCoreNamespace registers clojure.core for the warn-on-shadow check. Called once during rt initialization.
func SetLookupStatsEnabled ¶ added in v1.11.1
func SetLookupStatsEnabled(enabled bool)
func SetNSLookup ¶
SetNSLookup sets the global namespace lookup function.
func SetSuppressShadowWarn ¶ added in v1.12.0
func SetSuppressShadowWarn(v bool)
SetSuppressShadowWarn toggles the warn-on-core-shadow message. Set true only around trusted internal re-registration (init-time), and reset to false after.
func SetValueEquals ¶ added in v1.2.0
SetValueEquals sets the equality function (called by rt package during init).
func ToInt64 ¶ added in v1.13.0
ToInt64 is ToInt at full width: nothing narrows to the platform int on the way out. Arithmetic paths use this; index and length paths use ToInt.
Types ¶
type ArrayChunk ¶ added in v1.9.0
type ArrayChunk struct {
// contains filtered or unexported fields
}
ArrayChunk is a slice-backed IChunk. It uses an off/end window over a shared backing array so DropFirst is allocation-free.
func NewArrayChunk ¶ added in v1.9.0
func NewArrayChunk(vs []Value, off, end int) *ArrayChunk
NewArrayChunk wraps vs[off:end] as an IChunk. The slice is shared; callers must treat it as immutable from this point.
func NewArrayChunkFromValues ¶ added in v1.9.0
func NewArrayChunkFromValues(vs []Value) *ArrayChunk
NewArrayChunkFromValues copies vs into a fresh chunk. Convenience for callers that don't already have a stable backing slice.
func (*ArrayChunk) ChunkCount ¶ added in v1.9.0
func (c *ArrayChunk) ChunkCount() int
func (*ArrayChunk) Count ¶ added in v1.9.0
func (c *ArrayChunk) Count() Value
Counted lets Lisp `(count chunk)` work on a chunk directly.
func (*ArrayChunk) DropFirst ¶ added in v1.9.0
func (c *ArrayChunk) DropFirst() IChunk
func (*ArrayChunk) Nth ¶ added in v1.9.0
func (c *ArrayChunk) Nth(i int) Value
func (*ArrayChunk) RawCount ¶ added in v1.9.0
func (c *ArrayChunk) RawCount() int
func (*ArrayChunk) String ¶ added in v1.9.0
func (c *ArrayChunk) String() string
func (*ArrayChunk) Type ¶ added in v1.9.0
func (c *ArrayChunk) Type() ValueType
func (*ArrayChunk) Unbox ¶ added in v1.9.0
func (c *ArrayChunk) Unbox() any
func (*ArrayChunk) ValueAt ¶ added in v1.9.0
func (c *ArrayChunk) ValueAt(key Value) Value
Lookup so `(nth chunk i)` and `(get chunk i)` work.
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) Nth ¶ added in v1.11.0
func (l ArrayVector) Nth(i int) Value
func (ArrayVector) RawCount ¶
func (l ArrayVector) RawCount() int
func (ArrayVector) Seq ¶
func (l ArrayVector) Seq() Seq
func (ArrayVector) SeqFrom ¶ added in v1.12.0
func (l ArrayVector) SeqFrom(i int) Seq
SeqFrom returns a seq over v starting at index i, or nil when i is past the end. This lets callers step into a vector (e.g. next/rest fast paths) with a single allocation instead of Seq()+Next().
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. ChunkedFirst hands back a fresh *ArrayChunk window over the immutable backing array (the slice is shared, not copied) — a distinct chunk value, so the seq node itself is never mutated and stays safe to share across goroutines.
Chunk sizes GROW geometrically from 1 (1, 2, 4, 8, … clamped to length) rather than a fixed 32 quantum. The size-1 head chunk keeps `first`/short- circuit consumption element-wise (no over-realization), while the doubling amortizes longer walks — the allocation-minimizing shape given that ArrayVectors are overwhelmingly tiny (avg ~1.4 elements).
func (*ArrayVectorSeq) ChunkedFirst ¶ added in v1.12.0
func (s *ArrayVectorSeq) ChunkedFirst() IChunk
ChunkedFirst returns a fresh chunk window over [i, i+curChunkLen) of the immutable backing array (clamped to the end). It must be a distinct *ArrayChunk — NOT this seq node and NOT a field on it: an ArrayVectorSeq is a persistent value shared freely across goroutines, so writing a scratch field here would race concurrent calls on the same node (TestArrayVectorSeqChunked FirstRace), and returning s itself would make the chunk also a Seq and pollute chunk-vs-seq interface dispatch. The one small ArrayChunk descriptor allocated here (the backing slice is shared, not copied) is the cost of both.
func (*ArrayVectorSeq) ChunkedMore ¶ added in v1.12.0
func (s *ArrayVectorSeq) ChunkedMore() Seq
ChunkedMore is ChunkedNext but returns EmptyList (not nil) at the end.
func (*ArrayVectorSeq) ChunkedNext ¶ added in v1.12.0
func (s *ArrayVectorSeq) ChunkedNext() Seq
ChunkedNext advances past this chunk and DOUBLES the quantum, returning the seq positioned at the start of the next (larger) chunk, or nil at the end.
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) Nth ¶ added in v1.11.0
func (s *ArrayVectorSeq) Nth(i int) Value
Nth implements Indexed: positional access by integer index.
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() any
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 NewAtomWithMetaValidator ¶ added in v1.8.0
func (*Atom) CompareAndSet ¶ added in v1.10.0
CompareAndSet atomically sets the value to newVal only if the current value is identical to oldVal, returning true on success. Identity comparison (==), matching Clojure's compare-and-set!.
func (*Atom) RemoveWatch ¶
type BigDecimal ¶ added in v1.5.0
type BigDecimal struct {
// contains filtered or unexported fields
}
BigDecimal wraps *math/big.Float as a VM value with arbitrary precision.
func MustBigDecimalFromString ¶ added in v1.11.0
func MustBigDecimalFromString(s string) *BigDecimal
MustBigDecimalFromString builds a BigDecimal from a string, panicking on an unparseable input. Intended for gogen-emitted constant literals, whose source strings were already validated at read time, so the panic is unreachable in generated code — it exists only to give a single-value expression form (the (value, ok) signature of NewBigDecimalFromString can't be used inline).
func NewBigDecimal ¶ added in v1.5.0
func NewBigDecimal(v *big.Float) *BigDecimal
func NewBigDecimalFromBigInt ¶ added in v1.12.0
func NewBigDecimalFromBigInt(n *big.Int) *BigDecimal
func NewBigDecimalFromFloat64 ¶ added in v1.5.0
func NewBigDecimalFromFloat64(f float64) *BigDecimal
func NewBigDecimalFromInt64 ¶ added in v1.5.0
func NewBigDecimalFromInt64(n int64) *BigDecimal
func NewBigDecimalFromString ¶ added in v1.5.0
func NewBigDecimalFromString(s string) (*BigDecimal, bool)
func (*BigDecimal) Equals ¶ added in v1.5.0
func (b *BigDecimal) Equals(other Value) bool
Equals compares BigDecimals.
func (*BigDecimal) GoString ¶ added in v1.5.0
func (b *BigDecimal) GoString() string
func (*BigDecimal) Hash ¶ added in v1.5.0
func (b *BigDecimal) Hash() uint32
Hash implements Hashable.
func (*BigDecimal) String ¶ added in v1.5.0
func (b *BigDecimal) String() string
func (*BigDecimal) ToFloat64 ¶ added in v1.5.0
func (b *BigDecimal) ToFloat64() float64
ToFloat64 converts to float64.
func (*BigDecimal) Type ¶ added in v1.5.0
func (b *BigDecimal) Type() ValueType
func (*BigDecimal) Unbox ¶ added in v1.5.0
func (b *BigDecimal) Unbox() any
func (*BigDecimal) Val ¶ added in v1.5.0
func (b *BigDecimal) Val() *big.Float
type BigInt ¶
type BigInt struct {
// contains filtered or unexported fields
}
BigInt wraps *math/big.Int as a VM value.
func MustBigIntFromString ¶ added in v1.11.0
MustBigIntFromString builds a BigInt from its base-10 string form, panicking on an unparseable input. Intended for gogen-emitted constant literals (the source was validated at read time, so the panic is unreachable in generated code); gives a single-value expression form the (value, ok) constructor can't.
func NewBigIntFromInt64 ¶
func NewBigIntFromString ¶
func (*BigInt) Hash ¶
Hash implements Hashable — consistent with Int.Hash() for values that fit in int64.
type BindingSnapshot ¶ added in v1.8.0
func SnapshotBindings ¶ added in v1.8.0
func SnapshotBindings() BindingSnapshot
SnapshotBindings captures the root context's dynamic bindings — the explicit-propagation primitive a goroutine spawn hands to its child.
type BlockingDeref ¶ added in v1.10.0
BlockingDeref is a reference whose value may not be available yet (promise, future). DerefTimeout blocks up to timeoutMs for the value, returning timeoutVal on timeout. Backs Clojure's 3-arg deref.
type Boxed ¶
type Boxed struct {
// contains filtered or unexported fields
}
func (*Boxed) Hash ¶ added in v1.11.0
Hash implements Hashable. Without it, hashValue falls back to computeHash -> hashBytes(String()), which formats the boxed value via fmt.Sprintf("%v") on EVERY hash — catastrophic when boxed values (e.g. SourceInfo) are embedded in IR vectors that get hashed repeatedly during lowering (= comparisons, CSE, map/set keys). *Boxed is an immutable pointer, so we compute the String-based hash once and cache it. The value is identical to the old computeHash fallback, so map/set semantics are unchanged — only the repeated Sprintf is eliminated.
func (*Boxed) InvokeMethod ¶
type ChunkBuffer ¶ added in v1.9.0
type ChunkBuffer struct {
// contains filtered or unexported fields
}
ChunkBuffer is a mutable builder for an ArrayChunk. Use Append to fill, then Chunk() to finalize — the returned IChunk takes ownership of the buffer.
func NewChunkBuffer ¶ added in v1.9.0
func NewChunkBuffer(cap int) *ChunkBuffer
NewChunkBuffer returns a buffer pre-sized for cap elements. Append grows beyond cap if needed.
func (*ChunkBuffer) Append ¶ added in v1.9.0
func (b *ChunkBuffer) Append(v Value)
func (*ChunkBuffer) Chunk ¶ added in v1.9.0
func (b *ChunkBuffer) Chunk() IChunk
Chunk finalizes the buffer into an IChunk and clears the buffer so further Append calls operate on a fresh backing slice.
func (*ChunkBuffer) Count ¶ added in v1.9.0
func (b *ChunkBuffer) Count() Value
Counted: lets `(count buf)` return the number of elements buffered so far.
func (*ChunkBuffer) RawCount ¶ added in v1.9.0
func (b *ChunkBuffer) RawCount() int
func (*ChunkBuffer) String ¶ added in v1.9.0
func (b *ChunkBuffer) String() string
func (*ChunkBuffer) Type ¶ added in v1.9.0
func (b *ChunkBuffer) Type() ValueType
ChunkBuffer satisfies Value so it can be threaded through Lisp.
func (*ChunkBuffer) Unbox ¶ added in v1.9.0
func (b *ChunkBuffer) Unbox() any
type ChunkedCons ¶ added in v1.9.0
type ChunkedCons struct {
// contains filtered or unexported fields
}
ChunkedCons pairs a non-empty IChunk with a tail seq. It is itself both a Seq and an IChunkedSeq: the chunk is the head batch, `more` is whatever comes after.
func NewChunkedCons ¶ added in v1.9.0
func NewChunkedCons(chunk IChunk, more Seq) *ChunkedCons
NewChunkedCons returns a ChunkedCons. The chunk must be non-empty; callers that may have an empty chunk should use ConsChunk which folds the empty case down to `more`.
func (*ChunkedCons) ChunkedFirst ¶ added in v1.9.0
func (c *ChunkedCons) ChunkedFirst() IChunk
func (*ChunkedCons) ChunkedMore ¶ added in v1.9.0
func (c *ChunkedCons) ChunkedMore() Seq
func (*ChunkedCons) ChunkedNext ¶ added in v1.9.0
func (c *ChunkedCons) ChunkedNext() Seq
func (*ChunkedCons) Cons ¶ added in v1.9.0
func (c *ChunkedCons) Cons(val Value) Seq
func (*ChunkedCons) First ¶ added in v1.9.0
func (c *ChunkedCons) First() Value
func (*ChunkedCons) Hash ¶ added in v1.9.0
func (c *ChunkedCons) Hash() uint32
Hash implements Hashable, mirroring Cons/List ordered hashing so the three seq surfaces equate in sets and maps.
func (*ChunkedCons) More ¶ added in v1.9.0
func (c *ChunkedCons) More() Seq
func (*ChunkedCons) Next ¶ added in v1.9.0
func (c *ChunkedCons) Next() Seq
func (*ChunkedCons) Seq ¶ added in v1.9.0
func (c *ChunkedCons) Seq() Seq
func (*ChunkedCons) String ¶ added in v1.9.0
func (c *ChunkedCons) String() string
func (*ChunkedCons) Type ¶ added in v1.9.0
func (c *ChunkedCons) Type() ValueType
func (*ChunkedCons) Unbox ¶ added in v1.9.0
func (c *ChunkedCons) Unbox() any
type Closure ¶
type Closure struct {
// contains filtered or unexported fields
}
func (*Closure) WithMeta ¶ added in v1.12.0
WithMeta implements IMeta. Returns a copy carrying m; the compiled fn and the closed-over slots are immutable at call time, so sharing them is safe and only the metadata differs. Lets (with-meta (fn ...) m) round-trip through meta, which spying/instrumentation libraries (e.g. bond) rely on.
type CodeChunk ¶
type CodeChunk struct {
// contains filtered or unexported fields
}
func NewCodeChunk ¶
func NewCodeChunkWithCapacity ¶ added in v1.11.1
NewCodeChunkWithCapacity creates an empty chunk with preallocated code storage for n instructions.
func (*CodeChunk) AddLocalVar ¶ added in v1.10.0
AddLocalVar records the source name bound to a stack slot (debug info).
func (*CodeChunk) AddSourceInfo ¶
func (c *CodeChunk) AddSourceInfo(info SourceInfo)
AddSourceInfo records the source location for the current bytecode offset.
func (*CodeChunk) AddSourceInfoAt ¶ added in v1.11.1
func (c *CodeChunk) AddSourceInfoAt(ip int, info SourceInfo)
AddSourceInfoAt records the source location for the provided bytecode offset.
func (*CodeChunk) AppendChunk ¶
func (*CodeChunk) GetSourceMap ¶ added in v1.3.0
GetSourceMap returns the source map, may be nil.
func (*CodeChunk) LocalVars ¶ added in v1.10.0
LocalVars returns the chunk's local-variable debug table (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) ReserveLocalVars ¶ added in v1.11.1
ReserveLocalVars ensures the local-var debug table can hold n entries without growing.
func (*CodeChunk) ReserveSourceMap ¶ added in v1.11.1
ReserveSourceMap ensures the source-map backing storage can hold n entries without growing.
func (*CodeChunk) SetMaxStack ¶
func (*CodeChunk) SetSourceMap ¶ added in v1.12.0
SetSourceMap replaces the chunk's source map. Used by the decoder to inject a lazily-materialized map (whose entries are decoded on first Lookup) so bundle load skips per-chunk source-map allocation for the common no-error path.
type Collection ¶
type Collection interface {
Value
Counted
Empty() Collection
Conj(Value) Collection
}
Collection is implemented by all collections
type Comparator ¶ added in v1.5.0
Comparator is a function that compares two Values, returning -1, 0, or 1.
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 DType ¶ added in v1.5.0
type DType struct {
// contains filtered or unexported fields
}
DType is a dynamically-created ValueType for a deftype. Unlike RecordType, instances of a DType do NOT implement map behavior (no Associative, Lookup, Seqable, or Collection interfaces).
func (*DType) SetToString ¶ added in v1.13.0
SetToString installs a toString override for instances of this type.
type DTypeInstance ¶ added in v1.5.0
type DTypeInstance struct {
// contains filtered or unexported fields
}
DTypeInstance is a value created by a deftype constructor. Fields are stored in a flat array, accessed by symbol name via Receiver.
func NewDTypeInstance ¶ added in v1.5.0
func NewDTypeInstance(dt *DType, fields []Value) *DTypeInstance
func (*DTypeInstance) DType ¶ added in v1.5.0
func (d *DTypeInstance) DType() *DType
DType returns the type.
func (*DTypeInstance) Equals ¶ added in v1.5.0
func (d *DTypeInstance) Equals(other Value) bool
Equals: reference identity, matching JVM deftype semantics.
func (*DTypeInstance) Fields ¶ added in v1.5.0
func (d *DTypeInstance) Fields() []Value
Fields returns the field values.
func (*DTypeInstance) Hash ¶ added in v1.5.0
func (d *DTypeInstance) Hash() uint32
Hash: identity-based (matches JVM default hashCode).
func (*DTypeInstance) InvokeMethod ¶ added in v1.5.0
func (d *DTypeInstance) InvokeMethod(name Symbol, args []Value) (Value, error)
InvokeMethod implements Receiver so (.fieldname instance) returns the field. Both (.field x) and the explicit field-access form (.-field x) are accepted: the reader hands the latter through as the member symbol "-field", so a leading "-" is stripped before the field lookup (Clojure's .-field syntax).
func (*DTypeInstance) Meta ¶ added in v1.10.0
func (d *DTypeInstance) Meta() Value
Meta implements IMeta.
func (*DTypeInstance) SetField ¶ added in v1.10.0
func (d *DTypeInstance) SetField(name Symbol, val Value) error
SetField mutates a field in place by name. Backs cljs-style ^:mutable deftype fields. UNSYNCHRONIZED: not safe for concurrent access; callers must ensure exclusive access (single-threaded use, atoms, or explicit locks). A Go nil is normalized to NIL to preserve the field-value invariant.
func (*DTypeInstance) String ¶ added in v1.5.0
func (d *DTypeInstance) String() string
func (*DTypeInstance) Type ¶ added in v1.5.0
func (d *DTypeInstance) Type() ValueType
func (*DTypeInstance) Unbox ¶ added in v1.5.0
func (d *DTypeInstance) Unbox() any
func (*DTypeInstance) WithMeta ¶ added in v1.10.0
func (d *DTypeInstance) WithMeta(m Value) Value
WithMeta implements IMeta. Returns a copy carrying m; field storage is shared with the original (metadata does not affect fields).
The copy is constructed explicitly, NOT via `cp := *d`: a whole-struct copy would carry the rendering guard, which is 1 while this instance's toString override runs — so a copy taken inside the override, e.g. (with-meta this ...), would skip its own override forever. It would also read the guard non-atomically against a concurrent String(). Every new instance starts with rendering == 0.
type DefMetaPairs ¶ added in v1.13.0
type DefMetaPairs []Value
DefMetaPairs is the compact on-wire and deferred in-memory representation of metadata attached to a def. Entries alternate key, value. It is internal to bundle replay: ApplyVarMeta stores the pairs on the Var, and Var.Meta lazily materializes the public PersistentMap only when metadata is observed.
func (DefMetaPairs) Equals ¶ added in v1.13.0
func (p DefMetaPairs) Equals(other Value) bool
func (DefMetaPairs) Hash ¶ added in v1.13.0
func (p DefMetaPairs) Hash() uint32
func (DefMetaPairs) String ¶ added in v1.13.0
func (p DefMetaPairs) String() string
func (DefMetaPairs) Type ¶ added in v1.13.0
func (p DefMetaPairs) Type() ValueType
func (DefMetaPairs) Unbox ¶ added in v1.13.0
func (p DefMetaPairs) Unbox() any
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 NewExInfoWithClass ¶ added in v1.12.0
func NewExInfoWithClass(class *ExceptionClass, message string, cause error) *ExInfo
NewExInfoWithClass builds an exception value tagged with a java.lang.* class (constructed via Exception. and friends, or a wrapped Go runtime error). Tagged values carry no data map; ex-data returns nil for them.
func (*ExInfo) Data ¶
func (e *ExInfo) Data() *PersistentMap
func (*ExInfo) InvokeMethod ¶ added in v1.10.0
InvokeMethod implements Receiver so the JVM-interop method forms (.getMessage ex) / (.getCause ex) dispatch to an ex-info value. This lets libraries that branch on (instance? Throwable ex) and then call .getMessage — e.g. medley's ex-message/ex-cause on their :clj branch — work against let-go ex-info values. Mirrors the semantics of core's ex-message/ex-cause.
func (*ExInfo) Meta ¶ added in v1.10.0
Meta / WithMeta implement IMeta. Type hints compile to runtime metadata in let-go, so medley's (.getMessage ^Throwable ex) reaches (with-meta ex ...); supporting metadata lets that hinted call work. WithMeta returns a copy that is still *ExInfo, preserving Type()==ExInfoType (so (instance? Throwable ex) stays true) and InvokeMethod (so .getMessage/.getCause still dispatch).
type ExceptionClass ¶ added in v1.12.0
type ExceptionClass struct {
// contains filtered or unexported fields
}
ExceptionClass is a ValueType representing a JVM-style exception class. Instances form the java.lang.* hierarchy through the parent pointer; the walk in pkg/rt's directTypeAncestors follows it for instance? and typed catch dispatch. Exception VALUES are *ExInfo tagged with one of these classes; there is one Go struct for all exception values, not one per class.
func (*ExceptionClass) Name ¶ added in v1.12.0
func (c *ExceptionClass) Name() string
func (*ExceptionClass) Parent ¶ added in v1.12.0
func (c *ExceptionClass) Parent() *ExceptionClass
func (*ExceptionClass) String ¶ added in v1.12.0
func (c *ExceptionClass) String() string
func (*ExceptionClass) Type ¶ added in v1.12.0
func (c *ExceptionClass) Type() ValueType
func (*ExceptionClass) Unbox ¶ added in v1.12.0
func (c *ExceptionClass) Unbox() any
type ExecContext ¶ added in v1.11.0
type ExecContext struct {
// contains filtered or unexported fields
}
ExecContext is the single object that resolves an execution's dynamic state — both the dynamic-var binding stack and the structured-concurrency Scope (see docs/design/exec-context-threading.md). It is the *implementer* of invocation and of dynamic resolution: the eval loop, builtins, and goroutine spawn all go through an ExecContext rather than looking state up by goroutine id.
There is always an ExecContext in play. RootExecContext is the process default — its binding stack is the shared global one and its scope is the root Goroutines scope, so code that never asks for isolation behaves exactly as it always has. Per-goroutine isolation is explicit: a spawn hands the child a fresh ExecContext seeded from a snapshot of the parent's (ec.Child()) — carrying the parent's bindings and scope — so goroutines cannot interleave each other's dynamic state, with no goroutine-id lookup and no reuse hazard.
func NewExecContext ¶ added in v1.11.0
func NewExecContext() *ExecContext
NewExecContext returns a context with a fresh, empty binding stack.
func NewExecContextFrom ¶ added in v1.11.0
func NewExecContextFrom(snap BindingSnapshot) *ExecContext
NewExecContextFrom returns a fresh context whose binding stack is seeded from snap. bound-fn* no longer uses this directly for invocation — it overlays its captured snapshot onto a Child() of the calling context instead, so vars the snapshot didn't capture keep tracking the caller's live bindings rather than falling back to root (see bound-fn* in pkg/rt/lang.go). This constructor remains the general "start a context from exactly these bindings, nothing else" primitive for callers that do want full isolation.
func (*ExecContext) Bind ¶ added in v1.11.0
func (ec *ExecContext) Bind(fn Fn) Fn
Bind pins fn to this context: the returned Fn routes every later call through ec.Invoke, so a callback handed to context-free machinery (Atom retry loops, sort comparators, stored transducer steps) still resolves dynamic vars against the caller's context. At the root this is the identity — plain Invoke already resolves there — so root-context callers pay nothing.
func (*ExecContext) BindingSnapshot ¶ added in v1.11.0
func (ec *ExecContext) BindingSnapshot() BindingSnapshot
BindingSnapshot returns a snapshot of this context's current bindings, suitable for passing to NewExecContextFrom to isolate a child context. A nil receiver uses the root context.
func (*ExecContext) Child ¶ added in v1.11.0
func (ec *ExecContext) Child() *ExecContext
Child returns a fresh ExecContext seeded from a snapshot of this one's bindings — the explicit-propagation primitive used at goroutine boundaries. A nil receiver seeds from the root context.
func (*ExecContext) Context ¶ added in v1.11.0
func (ec *ExecContext) Context() context.Context
Context returns the cancellation context blocking native ops (channel take/put, alts!) select on — the scope's context.
func (*ExecContext) Deref ¶ added in v1.11.0
func (ec *ExecContext) Deref(v *Var) Value
func (*ExecContext) Invoke ¶ added in v1.11.0
func (ec *ExecContext) Invoke(fn Fn, args []Value) (Value, error)
Invoke runs fn with args in this context. Closures propagate the context to their child frame; context-aware natives receive it; pure functions are invoked unchanged. This is the single dispatch site the eval loop uses.
func (*ExecContext) PopBinding ¶ added in v1.11.0
func (ec *ExecContext) PopBinding(v *Var)
func (*ExecContext) PrepareCall ¶ added in v1.13.0
func (ec *ExecContext) PrepareCall(fn Fn, arity int) *PreparedCall
PrepareCall is the heap-allocating form of PrepareCallInto: it returns a new PreparedCall, or nil when fn cannot be prepared. Hot loops should prefer PrepareCallInto with a stack variable.
func (*ExecContext) PrepareCallInto ¶ added in v1.13.0
func (ec *ExecContext) PrepareCallInto(p *PreparedCall, fn Fn, arity int) bool
PrepareCallInto resolves fn for repeated arity-n invocation into p, which the caller owns — typically a stack variable in a native loop. It reports false, leaving p unusable, for targets that are not plain fixed-arity bytecode callables (variadic, native, protocol, ...) and for arities without a matching CallN method; callers fall back to ec.Invoke.
Nothing here allocates once the frame pool is warm: p is the caller's, the frame comes from the pool, and the argument slots live in the frame's prepArgs, which survives pool reuse. They deliberately do not alias argbuf, which installBytecodeCall overwrites on a same-frame tail call.
func (*ExecContext) PushBinding ¶ added in v1.11.0
func (ec *ExecContext) PushBinding(v *Var, val Value)
Exported entry points for runtime builtins (pkg/rt) that resolve dynamic vars against an ExecContext handed to them by ec.Invoke.
func (*ExecContext) Scope ¶ added in v1.11.0
func (ec *ExecContext) Scope() *Scope
Scope returns the structured-concurrency scope this context runs under, normalising the nil (root) context to the process-wide Goroutines scope. A nil receiver also resolves to the root.
func (*ExecContext) SetBinding ¶ added in v1.11.0
func (ec *ExecContext) SetBinding(v *Var, val Value) bool
SetBinding mutates v's top dynamic binding in this context (thread-local set!), returning false if v has no active binding here so the caller can fall back to the root. Exported for runtime builtins like in-ns.
func (*ExecContext) SetScope ¶ added in v1.11.0
func (ec *ExecContext) SetScope(s *Scope)
SetScope installs s as this context's scope. Used by with-scope to open a child scope for a dynamic extent and to restore the previous one on close.
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 NewFrameIn ¶ added in v1.13.0
func NewFrameIn(code *CodeChunk, args []Value, ec *ExecContext) *Frame
NewFrameIn is NewFrame with the given execution context installed, so the frame resolves dynamic bindings and its structured-concurrency scope against the caller rather than the root. Used by eval-style natives that compile a form and must run it where the caller is.
func (*Frame) Run ¶
Run executes this frame to completion. The dispatch loop descends into bytecode callees within one dispatch loop, keeping the Go stack flat. A parent link on each live frame carries the suspended call chain without a retained slice.
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.
func (*Frame) SetExecContext ¶ added in v1.13.0
func (f *Frame) SetExecContext(ec *ExecContext)
SetExecContext installs the dynamic execution state used when the frame invokes bytecode and context-aware native functions. A nil context retains the normal RootExecContext fallback.
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 ¶
func (*Func) WithMeta ¶ added in v1.12.0
WithMeta implements IMeta. Returns a copy carrying m. A capture-free fn is a shared compiler constant pushed by OP_LOAD_CONST, so this MUST copy rather than mutate — otherwise every evaluation of the fn literal would observe the metadata. The chunk is immutable, so sharing it across the copy is safe.
type FuncInterface ¶
type FuncInterface func(any)
type GoPanicError ¶ added in v1.9.0
type GoPanicError struct {
// contains filtered or unexported fields
}
GoPanicError wraps an unexpected Go panic (one that is NOT a let-go thrown error) together with the Go stack captured at the recover site. Native-fn crashes — e.g. a `syscall/js: Value.Int on undefined` under WASM, or a nil dereference in a Go builtin — have no let-go source location, so without this the only traceback was an unhelpful `at <fn> (<unknown>)`. The captured Go stack pins the actual crash site (the .go file:line) and FormatError surfaces the let-go-relevant frames.
func (*GoPanicError) Error ¶ added in v1.9.0
func (e *GoPanicError) Error() string
func (*GoPanicError) GoStack ¶ added in v1.9.0
func (e *GoPanicError) GoStack() string
GoStack returns the raw Go stack trace captured when the panic was recovered.
type Hashable ¶
type Hashable interface {
Hash() uint32
}
Hashable is implemented by types that cache their hash for fast map lookups.
type IChunk ¶ added in v1.9.0
IChunk is a fixed-size, indexable, sliceable batch of Values. Implementations may share backing storage; DropFirst must never mutate.
Note: the per-chunk size is exposed as ChunkCount() rather than Count() because concrete chunks (ArrayChunk, ChunkBuffer) also satisfy the Counted protocol — which requires Count() Value and RawCount() int — and Go interfaces cannot disambiguate two methods with the same name and different return types.
type IChunkedSeq ¶ added in v1.9.0
type IChunkedSeq interface {
Seq
ChunkedFirst() IChunk
ChunkedNext() Seq // nil at end
ChunkedMore() Seq // EmptyList at end
}
IChunkedSeq is a Seq that can yield a whole chunk at a time. Consumers may dispatch on this interface to amortize per-element overhead; the Seq methods (First/Next/More) must remain consistent with the chunked view: First() == ChunkedFirst().Nth(0), Next() walks within the chunk before moving to ChunkedNext().
func AsChunkedSeq ¶ added in v1.9.0
func AsChunkedSeq(s Seq) (IChunkedSeq, bool)
AsChunkedSeq returns the chunked view of s if available, resolving through LazySeq wrappers. Returns (cs, true) if s ultimately resolves to a non-empty IChunkedSeq, (nil, false) otherwise (including for empty seqs).
Callers use this to choose a chunked fast path:
if cs, ok := AsChunkedSeq(s); ok {
// process cs.ChunkedFirst() in bulk, recurse on cs.ChunkedMore()
}
// fallback: one-at-a-time
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 Indexed ¶ added in v1.11.0
Indexed marks positional collections — those whose elements are addressed by a 0-based integer index, as opposed to maps/sets (key-addressable) and lazy seqs (sequential-only). `nth` dispatches on this to use an O(1)-ish indexed access without seq traversal. Implementations must satisfy: Nth(i) is valid for 0 <= i < RawCount(); callers bounds-check via RawCount() before calling.
Crucially this excludes maps/sets (which are Lookup+Counted but NOT positional) and transient/chunk types that aren't seqable — so adding a new positional type is a matter of implementing this interface, not editing a type switch.
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) ChunkedFirst ¶ added in v1.9.0
func (r *InfiniteRange) ChunkedFirst() IChunk
InfiniteRange's chunked view emits a full rangeChunkSize chunk every time and never returns nil from ChunkedNext/More — consumers must short-circuit.
func (*InfiniteRange) ChunkedMore ¶ added in v1.9.0
func (r *InfiniteRange) ChunkedMore() Seq
func (*InfiniteRange) ChunkedNext ¶ added in v1.9.0
func (r *InfiniteRange) ChunkedNext() Seq
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() any
type Instant ¶ added in v1.8.0
type Instant struct {
// contains filtered or unexported fields
}
Instant wraps a time.Time, normalised to UTC at millisecond precision.
Precision is millisecond to match Clojure JVM (java.util.Date) and ClojureScript (js/Date), so values round-trip cleanly through any Clojure tool reading the same RFC3339 string.
func NewInstant ¶ added in v1.8.0
NewInstant constructs an Instant from a time.Time, normalising to UTC at millisecond precision.
The caller is responsible for ensuring the year is in 0..9999 — values outside that range will not round-trip through Val()/ParseInstant and will silently break AOT bytecode serialisation. The only value-system entry point that takes a host time.Time is InstantType.Box, which enforces this bound; direct Go callers must do the same.
func ParseInstant ¶ added in v1.8.0
ParseInstant parses an RFC3339 (or RFC3339Nano) timestamp. Returns nil if invalid. Sub-millisecond precision in the input is truncated.
func (*Instant) Equals ¶ added in v1.8.0
Equals compares by epoch milliseconds. After UTC+millis normalisation in the constructors this matches t.Equal, but expressing it directly in terms of UnixMilli decouples value identity from time.Time internals (e.g. any monotonic clock reading).
func (*Instant) Hash ¶ added in v1.8.0
Hash implements Hashable. Grounded in epoch milliseconds (the actual value) rather than the formatted string so hash identity is independent of presentation choices (RFC3339Nano trims trailing zeros, etc.).
type Int ¶
type Int int64
Int is the boxed integer. It is 64 bits wide on every host, like Clojure's long: a value never depends on the platform's int width, so a 32-bit-int target (linux/386, TinyGo wasm) computes exactly what a 64-bit one does.
type Iterate ¶
type Iterate struct {
// contains filtered or unexported fields
}
Iterate is a Value whose only value is Iterate
func NewIterate ¶
type Keyword ¶
type Keyword string
Keyword is boxed int
func (Keyword) InvokeMethod ¶ added in v1.13.0
InvokeMethod implements Receiver so JVM-interop calls on keywords resolve, matching clojure.lang.Keyword's public accessors. Motivated by honeysql, whose :clj branch converts keywords to symbols via (.sym k).
func (Keyword) Namespaced ¶
func (Keyword) NamespacedRaw ¶ added in v1.12.0
type KeywordLookup ¶ added in v1.12.0
type KeywordLookup interface {
ValueAtKeyword(k Keyword) Value
ValueAtKeywordOr(k Keyword, dflt Value) Value
}
KeywordLookup is an optional fast path for keyword-keyed lookup that avoids boxing the Keyword into a Value interface (type Keyword string boxes on interface conversion — a heap alloc). Keyword.Invoke prefers it when present.
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
func (*LazySeq) Hash ¶ added in v1.8.0
Hash implements Hashable. Resolves the lazy chain and hashes as an ordered collection, matching *List/*Cons so the three sequence representations equate in sets/maps. An empty resolution (Go nil from a (lazy-seq nil)) must hash the same as EmptyList — Resolve() returns nil but EmptyList.Hash iterates once over its sentinel element, so we substitute EmptyList here.
func (*LazySeq) IsRealized ¶ added in v1.8.0
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 LocalVar ¶ added in v1.10.0
CodeChunk holds bytecode and provides facilities for reading and writing it LocalVar is a debug-info entry mapping a stack slot to the original source name of a local binding (let/loop binding, fn parameter, catch binding). Carried so crash traces from bundle-loaded code (e.g. under WASM) can name local variables, not just slots.
type LookupStats ¶ added in v1.11.1
type LookupStats struct {
NamespacedCalls uint64
LookupCalls uint64
NamespacedBySym map[string]uint64
LookupByNS map[string]uint64
LookupByNSSym map[string]uint64
}
func SnapshotLookupStats ¶ added in v1.11.1
func SnapshotLookupStats() LookupStats
func (LookupStats) Summary ¶ added in v1.11.1
func (s LookupStats) Summary() string
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 MapEntry ¶
MapEntry is a key-value pair.
func (MapEntry) Conj ¶ added in v1.6.0
func (e MapEntry) Conj(v Value) Collection
func (MapEntry) Empty ¶ added in v1.6.0
func (e MapEntry) Empty() Collection
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 MetaFn ¶ added in v1.12.0
MetaFn adds the Fn surface to the generic metadata decorator. ExecContext unwraps it before dispatch so closures and context-aware natives still receive the caller's dynamic context.
type MetaValue ¶ added in v1.12.0
type MetaValue[T Value] struct { // contains filtered or unexported fields }
MetaValue decorates any Value with metadata while delegating its ordinary Value behavior to the wrapped value.
func NewMetaValue ¶ added in v1.12.0
func (*MetaValue[T]) InvokeMethod ¶ added in v1.13.0
InvokeMethod delegates JVM-interop method dispatch to the wrapped value. Metadata must not strip a value's Receiver surface: a ^Tag hint in expression position compiles to a runtime with-meta wrap, so e.g. (.sym ^clojure.lang.Keyword k) reaches the keyword through this decorator.
type MultiArityFn ¶
type MultiArityFn struct {
// contains filtered or unexported fields
}
func MakeMultiArity ¶ added in v1.9.0
func MakeMultiArity(fns []Value) (*MultiArityFn, error)
func (*MultiArityFn) Arity ¶
func (l *MultiArityFn) Arity() int
func (*MultiArityFn) MakeClosure ¶ added in v1.9.0
func (l *MultiArityFn) MakeClosure() Fn
func (*MultiArityFn) Meta ¶ added in v1.12.0
func (l *MultiArityFn) Meta() Value
Meta implements IMeta.
func (*MultiArityFn) String ¶
func (l *MultiArityFn) String() string
func (*MultiArityFn) Type ¶
func (l *MultiArityFn) Type() ValueType
func (*MultiArityFn) WithMeta ¶ added in v1.12.0
func (l *MultiArityFn) WithMeta(m Value) Value
WithMeta implements IMeta. Returns a copy carrying m; the arity variants are immutable at call time, so sharing them across the copy is safe.
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) FreezeNative ¶ added in v1.11.0
func (m *MultiFn) FreezeNative()
FreezeNative marks this MultiFn as the captured baseline for generated native dispatch arms. Done once, in place, at namespace-load completion (rt.ApplyGoOverrides) — the var still points at this exact pointer, and any later AddMethod/RemoveMethod yields a fresh, unfrozen MultiFn.
func (*MultiFn) GetMethod ¶ added in v1.12.0
GetMethod returns the method fn that dispatch value dv would select — the exact match, else the default method, else NIL. Mirrors invokeIn's method selection (let-go multimethods dispatch on exact value + default, not the isa? hierarchy). Backs the core get-method fn.
func (*MultiFn) IsNativeFrozen ¶ added in v1.11.0
IsNativeFrozen reports whether this MultiFn is still the native baseline (no defmethod has replaced it since FreezeNative). The generated type-switch only trusts its baked arms while this holds.
func (*MultiFn) Methods ¶
func (m *MultiFn) Methods() *PersistentMap
Methods returns the method map.
func (*MultiFn) RemoveMethod ¶
RemoveMethod unregisters an implementation.
func (*MultiFn) WithMeta ¶ added in v1.12.0
WithMeta implements IMeta. Returns a copy carrying meta; the dispatch fn and (immutable-persistent) method map are shared. let-go's fn? includes MultiFn, so multimethods round-trip metadata like every other fn? value. The copy keeps frozen=false — a meta'd copy is not the native dispatch baseline.
type Namespace ¶
type Namespace struct {
// contains filtered or unexported fields
}
func NewNamespace ¶
func (*Namespace) Alias ¶
Alias creates a symbol alias to another namespace in this namespace.
Collision guard: re-pointing an existing alias at a DIFFERENT namespace is almost always a bug — either two `:as` clauses in one ns picking the same short name for different libs, or (historically) cross-namespace alias-table contamination during dependency loading. Rather than letting the last writer silently win, warn so the conflict is visible. Re-aliasing to the SAME target (idempotent ns reload) and first-time aliasing are silent. Sameness is by NAME, not pointer: a reload that re-creates the namespace object (e.g. the jank suite benchmark re-running the whole corpus per iteration) is still the idempotent case — pointer comparison made it warn "already points to X, being repointed to X", and since `go test` merges the test binary's stderr into its stdout, that spam landed between a benchmark's name and its metrics line, making benchfmt drop the suite [bytecode] results entirely.
func (*Namespace) AliasesSnapshot ¶ added in v1.13.0
AliasesSnapshot copies the namespace's alias table (short-name -> target namespace, as installed by `:as`/`alias`). Backs the ns-aliases core fn.
func (*Namespace) AllVars ¶ added in v1.13.0
AllVars snapshots every interned var (public and private). Diagnostic use.
func (*Namespace) AlterMeta ¶ added in v1.13.0
AlterMeta replaces the namespace metadata with f(current). f runs WITHOUT the namespace lock held, so it may safely call back into this namespace (e.g. read or alter its own meta) without deadlocking — matching Var.AlterMeta. As with Var, concurrent AlterMeta calls on the same namespace are last-writer-wins: each reads current meta, computes its own next value, and stores it, so a racing writer's result can be clobbered.
func (*Namespace) DefStub ¶ added in v1.8.0
DefStub interns an UNBOUND var (no root) without triggering the warn-on-shadow check. Intended for bundle decoders that pre-populate var references before the namespace's own chunk runs (which Defs the ones that have an init). Leaving the root unset is load-bearing: a no-init (def x) / (declare x) emits only OP_LOAD_CONST, so the stub is the var that survives into the namespace, and it must report (bound? (var x)) == false to match the source-compiled path (LookupOrAdd). A NIL root would make precompiled / LGB-loaded code wrongly appear bound, breaking def/declare promise semantics. Do NOT use DefStub to intentionally suppress warnings for new code; use Namespace.Exclude (via :refer-clojure :exclude) instead.
func (*Namespace) Exclude ¶ added in v1.8.0
Exclude marks a symbol as excluded from clojure.core auto-refer. Called from the ns macro for :refer-clojure :exclude [...].
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) IsExcluded ¶ added in v1.8.0
IsExcluded reports whether the symbol is in the exclude set.
func (*Namespace) LookupIncludingPrivate ¶ added in v1.13.0
LookupIncludingPrivate resolves like Lookup but ignores the private flag on qualified references. It backs the var special form (#'ns/sym): Clojure enforces privacy only on bare qualified symbol references — (var ns/sym) reaches private vars in any namespace.
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) Meta ¶ added in v1.13.0
Meta returns the namespace metadata, or NIL when none has been set.
func (*Namespace) PublicVars ¶ added in v1.12.0
PublicVars snapshots the namespace's own non-private interned vars, keyed by their unqualified symbol. Backs the ns-publics core fn. isPrivate is a plain field read, so filtering under the read lock introduces no lock-order risk.
func (*Namespace) Refer ¶
Refer installs a refer entry for ns into this namespace. An explicit refer — :all here, or a later ReferList call — is how Clojure lets you undo a prior ns-unmap: it clears the `unmapped` tombstone for any symbol the refer newly brings into scope, so (resolve sym) sees it again. ns's PublicVars snapshot is read BEFORE n's own lock is taken, honoring the no-nested-namespace-locks invariant above.
func (*Namespace) ReferList ¶
ReferList refers only selected symbols from the given namespace into this namespace. Clears any `unmapped` tombstone on those symbols — see Refer.
func (*Namespace) ReferredVars ¶ added in v1.13.0
ReferredVars snapshots every var visible in this namespace via refer — baseline auto-refers (clojure.core, let-go.core, …) plus explicit (:require ... :refer) / (use ...) refers — keyed by unqualified symbol. Mirrors lookupViaRefers's precedence: an explicit refer for a symbol shadows a baseline hit for that same symbol. Backs the ns-refers core fn. Vars this namespace interns itself are NOT included here — those belong to AllVars/PublicVars (ns-interns/ns-publics); ns-map (the union) overlays AllVars on top of this result to reproduce that shadowing.
func (*Namespace) RegistrySize ¶
func (*Namespace) ResolveAlias ¶
ResolveAlias returns the namespace for the given alias, or nil.
func (*Namespace) Unmap ¶ added in v1.13.0
Unmap removes a symbol's mapping from this namespace, whether it is a locally interned var or one only visible via refer. Backs the ns-unmap core fn. Clojure semantics: after ns-unmap, the symbol resolves to nothing in this namespace until re-interned or re-referred — so beyond deleting any local registry entry, the symbol is recorded in `unmapped`, which lookupViaRefers and ReferredVars both honor to hide it from refers too. This is deliberately a separate set from `excludes` (:refer-clojure :exclude): that one only suppresses the warn-on-shadow message and must NOT block refer resolution — some core namespaces (e.g. string.lg) declare :exclude for a name while still relying on it resolving to clojure.core's version until their own same-named def further down the file runs. A later (def name ...) still works fine here regardless: Lookup checks the local registry before ever consulting refers. The tombstone isn't permanent: Refer/ReferList clear it for any symbol they newly bring back into scope, so an explicit re-refer restores visibility just like Clojure.
type NativeFn ¶
type NativeFn struct {
// contains filtered or unexported fields
}
func NewArityNativeFn ¶ added in v1.13.0
func NewArityNativeFn(name string, arity int, variadic bool, fn func(ec *ExecContext, args []Value) (Value, error)) *NativeFn
NewArityNativeFn builds a context-aware native that DECLARES a fixed arity (or a variadic minimum) rather than the -1/variadic default NewCtxNativeFn uses. The declared arity is what MakeMultiArity dispatches on: an arm whose Arity() is -1 and isVariadric is true is indistinguishable from a rest-arm, so a wrapper built the ordinary way collapses every arm of a multi-arity fn into ma.rest and leaves ma.fns empty. Callers that wrap an opaque callable (ir.direct's invokers) use this to keep the arity visible to dispatch.
func NewCtxNativeFn ¶ added in v1.11.0
NewCtxNativeFn builds a context-aware native builtin. Its plain Invoke resolves against the root context (host/reflection callers); ec.Invoke routes the real context in.
func (*NativeFn) IsVariadic ¶ added in v1.13.0
IsVariadic reports whether this native declares a variadic tail.
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 (n *Nil) Dissoc(k Value) Associative
func (*Nil) Empty ¶
func (n *Nil) Empty() Collection
type PairSample ¶ added in v1.9.0
PairSample is one entry in a pair-count snapshot.
func PairSnapshot ¶ added in v1.9.0
func PairSnapshot() []PairSample
PairSnapshot returns the current per-pair counts, sorted desc. Only entries with non-zero counts are returned.
type PersistentMap ¶
type PersistentMap struct {
// contains filtered or unexported fields
}
PersistentMap is an immutable map with two internal representations behind the single public MapType, mirroring Clojure's PersistentArrayMap/PersistentHashMap split:
- ordered array-map mode: root == nil, entries live in okvs as an alternating key/value slice in insertion order, count ≤ arrayMapMaxEntries, lookups are a linear scan;
- HAMT mode: root != nil, okvs == nil, iteration order unspecified.
Assoc past the threshold promotes to HAMT mode; Dissoc never demotes a non-empty map (matching Clojure). The one deliberate exception: draining a HAMT map to zero entries yields the empty ordered-mode map — an empty map has no order to lose, and rebuilding from it behaves exactly like a fresh {} (Clojure instead stays a hash map there; both orders are within the unspecified small-hash-map contract). Equality and hash are order- and representation-insensitive.
func MapFromGoMap ¶
func MapFromGoMap(m map[Value]Value) *PersistentMap
MapFromGoMap converts a Go map[Value]Value to a *PersistentMap.
func NewArrayMap ¶ added in v1.8.0
func NewArrayMap(kvs []Value) *PersistentMap
NewArrayMap creates a PersistentMap from an alternating key-value slice. Matches Clojure's array-map contract: up to arrayMapMaxEntries entries the result is in insertion-ordered array-map mode; past that it promotes to the HAMT and iteration order is unspecified. Map literals flow through here (reader constants directly; compiled literals via the array-map call the compiler emits from the read-time map's ordered Seq).
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() any
func (*PersistentMap) ValueAt ¶
func (m *PersistentMap) ValueAt(key Value) Value
func (*PersistentMap) ValueAtKeyword ¶ added in v1.12.0
func (m *PersistentMap) ValueAtKeyword(k Keyword) Value
func (*PersistentMap) ValueAtKeywordOr ¶ added in v1.12.0
func (m *PersistentMap) ValueAtKeywordOr(k Keyword, dflt Value) Value
func (*PersistentMap) WithMeta ¶
func (m *PersistentMap) WithMeta(meta Value) Value
WithMeta implements IMeta.
type PersistentQueue ¶ added in v1.12.0
type PersistentQueue struct {
// contains filtered or unexported fields
}
PersistentQueue is an immutable FIFO queue. The empty queue has front == nil.
var EmptyPersistentQueue *PersistentQueue = &PersistentQueue{}
EmptyPersistentQueue is the canonical empty queue (clojure.lang.PersistentQueue/EMPTY).
func (*PersistentQueue) Conj ¶ added in v1.12.0
func (q *PersistentQueue) Conj(value Value) Collection
Conj implements Collection — appends to the rear (Clojure enqueue semantics). The very first element seeds the front instead, so peek always has somewhere to read from.
func (*PersistentQueue) Count ¶ added in v1.12.0
func (q *PersistentQueue) Count() Value
func (*PersistentQueue) Empty ¶ added in v1.12.0
func (q *PersistentQueue) Empty() Collection
Empty implements Collection.
func (*PersistentQueue) Equals ¶ added in v1.12.0
func (q *PersistentQueue) Equals(other Value) bool
Equals implements value equality — another queue with the same elements in the same FIFO order.
func (*PersistentQueue) Hash ¶ added in v1.12.0
func (q *PersistentQueue) Hash() uint32
Hash implements Hashable — order-sensitive, over the FIFO sequence.
func (*PersistentQueue) Meta ¶ added in v1.12.0
func (q *PersistentQueue) Meta() Value
Meta / WithMeta implement IMeta.
func (*PersistentQueue) Peek ¶ added in v1.12.0
func (q *PersistentQueue) Peek() Value
Peek returns the front element, or NIL when empty.
func (*PersistentQueue) Pop ¶ added in v1.12.0
func (q *PersistentQueue) Pop() *PersistentQueue
Pop returns the queue without its front element. Popping the empty queue returns it unchanged (matching Clojure, which does not throw here). When the front seq drains, the rear is promoted to become the new front in FIFO order.
func (*PersistentQueue) RawCount ¶ added in v1.12.0
func (q *PersistentQueue) RawCount() int
RawCount / Count implement Counted.
func (*PersistentQueue) Seq ¶ added in v1.12.0
func (q *PersistentQueue) Seq() Seq
Seq implements Sequable — front elements first, then the rear in FIFO order. Returns EmptyList for the empty queue (the seq builtin maps that to nil).
func (*PersistentQueue) String ¶ added in v1.12.0
func (q *PersistentQueue) String() string
func (*PersistentQueue) Type ¶ added in v1.12.0
func (q *PersistentQueue) Type() ValueType
Type implements Value.
func (*PersistentQueue) Unbox ¶ added in v1.12.0
func (q *PersistentQueue) Unbox() any
Unbox implements Value — a flat []Value in FIFO order.
func (*PersistentQueue) WithMeta ¶ added in v1.12.0
func (q *PersistentQueue) WithMeta(m Value) Value
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() any
func (*PersistentSet) ValueAt ¶ added in v1.5.0
func (s *PersistentSet) ValueAt(key Value) Value
func (*PersistentSet) ValueAtOr ¶ added in v1.5.0
func (s *PersistentSet) ValueAtOr(key Value, dflt Value) Value
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) IdentityKey ¶ added in v1.12.0
func (v PersistentVector) IdentityKey() uintptr
IdentityKey returns an opaque key for the vector's private identity token. A zero-value PersistentVector has no token and returns zero.
func (PersistentVector) Invoke ¶
func (v PersistentVector) Invoke(args []Value) (Value, error)
Invoke implements IFn
func (PersistentVector) Nth ¶ added in v1.11.0
func (v PersistentVector) Nth(i int) Value
Nth implements Indexed: positional access by integer index.
func (PersistentVector) Pop ¶ added in v1.11.0
func (v PersistentVector) Pop() PersistentVector
Pop returns a new vector with the last element removed, in O(1) amortized time (mirrors Clojure's PersistentVector.pop). The previous behavior — the `pop` builtin doing Unbox()+NewPersistentVector(all-but-last) — was O(n) per call, which made vector-as-stack uses (e.g. the typeinfer worklist drain via peek/pop) O(n^2) and a major allocation source. Returns the empty vector for count <= 1; callers that must reject popping an empty vector check count first.
func (PersistentVector) RawCount ¶
func (v PersistentVector) RawCount() int
func (PersistentVector) SameIdentity ¶ added in v1.12.0
func (v PersistentVector) SameIdentity(other PersistentVector) bool
SameIdentity reports whether two PersistentVector values are copies of the same logical vector. The token itself remains private to the vm package.
func (PersistentVector) Seq ¶
func (v PersistentVector) Seq() Seq
Modify PersistentVector's Seq method:
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) ChunkedFirst ¶ added in v1.9.0
func (s *PersistentVectorSeq) ChunkedFirst() IChunk
ChunkedFirst returns the chunk starting at the current position.
func (*PersistentVectorSeq) ChunkedMore ¶ added in v1.9.0
func (s *PersistentVectorSeq) ChunkedMore() Seq
ChunkedMore is like ChunkedNext but returns EmptyList instead of nil at the end, matching Clojure's IChunkedSeq.chunkedMore.
func (*PersistentVectorSeq) ChunkedNext ¶ added in v1.9.0
func (s *PersistentVectorSeq) ChunkedNext() Seq
ChunkedNext advances by one whole chunk, returning the seq positioned at the start of the following chunk, or nil at the end.
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) Nth ¶ added in v1.11.0
func (s *PersistentVectorSeq) Nth(i int) Value
Nth implements Indexed: positional access by integer index.
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() any
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 PreparedCall ¶ added in v1.13.0
type PreparedCall struct {
// contains filtered or unexported fields
}
PreparedCall caches the resolution of a fixed-arity bytecode callable and reuses one frame across many calls from native code. It exists for per-element callback loops (reduce/some/filter and friends): resolution, frame-pool traffic, and frame initialization are per-call-site constants, so paying them once per seq operation instead of once per element removes most of the host->VM entry cost.
A PreparedCall is single-owner: it must be used by one native call activation and never shared or called reentrantly. Nested uses of the same lg function each prepare their own.
func (*PreparedCall) Call1 ¶ added in v1.13.0
func (p *PreparedCall) Call1(a Value) (Value, error)
Call1 invokes the prepared unary callable. Calling it on a preparation of any other arity is a contract violation and returns an error.
func (*PreparedCall) Call2 ¶ added in v1.13.0
func (p *PreparedCall) Call2(a, b Value) (Value, error)
Call2 invokes the prepared binary callable. Calling it on a preparation of any other arity is a contract violation and returns an error.
func (*PreparedCall) Release ¶ added in v1.13.0
func (p *PreparedCall) Release()
Release returns the owned frame to the pool. The PreparedCall must not be used afterwards.
type ProfileSample ¶ added in v1.9.0
ProfileSample is one entry in a profile snapshot.
func ProfileSnapshot ¶ added in v1.9.0
func ProfileSnapshot() []ProfileSample
ProfileSnapshot returns the current per-opcode counts, sorted desc. Only entries with non-zero counts are returned.
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) DerefTimeout ¶ added in v1.10.0
DerefTimeout blocks until the promise is delivered or timeoutMs elapses, returning timeoutVal on timeout. Backs Clojure's 3-arg deref for blocking refs (promises/futures).
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 extended EXACTLY (extend-type on a concrete type). Exact extensions always win: they overwrite a prior TypeUnion-sourced implementation and are never overwritten by a later one — Clojure's exact-type-over-interface dispatch precedence, independent of registration order. implMap is a PersistentMap of {method-keyword → fn}.
func (*Protocol) ExtendNil ¶
func (p *Protocol) ExtendNil(implMap *PersistentMap)
ExtendNil adds implementations for nil.
func (*Protocol) ExtendViaUnion ¶ added in v1.12.0
func (p *Protocol) ExtendViaUnion(vt ValueType, implMap *PersistentMap)
ExtendViaUnion adds implementations for one member of a TypeUnion (a compatibility interface like clojure.lang.IPersistentVector fanning out to its concrete vm types). It never clobbers an exact Extend on the same type; unions overwrite only other unions (last union wins, matching Clojure's unspecified interface-vs-interface order).
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() any
func (*ProtocolFn) WithMeta ¶ added in v1.12.0
func (f *ProtocolFn) WithMeta(m Value) Value
WithMeta implements IMeta. Returns a copy carrying m; the protocol and method name are shared (metadata does not affect dispatch), matching the other FuncType values so a protocol method round-trips metadata like any fn.
type Range ¶
type Range struct {
// contains filtered or unexported fields
}
Range is a lazy integer sequence with start, end, and step.
func (*Range) Bounds ¶ added in v1.12.0
Bounds exposes the range arithmetic (start, end, step) so callers like reduce can iterate a Range with plain arithmetic — no seq or chunk allocation. step is never 0 for a materialized *Range.
func (*Range) ChunkedFirst ¶ added in v1.9.0
ChunkedFirst returns up to rangeChunkSize values starting from l.start, stopping at the range's end. The chunk holds materialized Int values; this is one O(chunkSize) allocation per chunk in exchange for amortizing the element-wise allocation overhead of l.Next().
func (*Range) ChunkedMore ¶ added in v1.9.0
func (*Range) ChunkedNext ¶ added in v1.9.0
ChunkedNext returns the range positioned at the element after the current chunk, or nil if the current chunk consumes the whole range.
func (*Range) Conj ¶
func (l *Range) Conj(val Value) Collection
type Ratio ¶ added in v1.5.0
type Ratio struct {
// contains filtered or unexported fields
}
Ratio wraps *math/big.Rat as a VM value.
func MustRatioFromString ¶ added in v1.11.0
MustRatioFromString builds a Ratio from its "num/den" string form, panicking on an unparseable input. Intended for gogen-emitted constant literals: the source was already validated at read time (and reduced past integer form, so the value is genuinely a Ratio), making the panic unreachable in generated code. Gives a single-value expression form keyed off the value's own String().
func NewRatioFromInts ¶ added in v1.5.0
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 ¶
Origin returns the original Go struct if this Record was created from one, or nil.
func (*Record) RecordType ¶
func (r *Record) RecordType() *RecordType
func (*Record) Seq ¶
Seq returns all entries — fixed fields first (in definition order), then extras.
func (*Record) ValueAtKeyword ¶ added in v1.12.0
ValueAtKeyword is a box-free fast path for keyword-based record access.
func (*Record) ValueAtKeywordOr ¶ added in v1.12.0
type RecordBase ¶ added in v1.11.0
type RecordBase struct {
TypeName string
// contains filtered or unexported fields
}
RecordBase is embedded by gogen-generated record/op structs so they satisfy vm.Value without per-type boilerplate. Field-specific behavior (field access, equality over fields) is added by the generated struct; this covers the type-identity and stringification contract.
Usage in generated code:
type MyRecord struct {
RecordBase
fieldOne Value
fieldTwo Value
}
The embedding struct automatically satisfies the Value interface.
func (*RecordBase) String ¶ added in v1.11.0
func (r *RecordBase) String() string
String returns the TypeName. Required by fmt.Stringer (part of Value interface).
func (*RecordBase) Type ¶ added in v1.11.0
func (r *RecordBase) Type() ValueType
Type returns a ValueType representing this record's type. The ValueType is lazily created and cached.
func (*RecordBase) Unbox ¶ added in v1.11.0
func (r *RecordBase) Unbox() any
Unbox returns the embedded *RecordBase, NOT the outer embedding struct. Because Unbox is a method on RecordBase promoted onto the embedding type, its receiver is always *RecordBase — Go method promotion cannot recover the outer value. Callers that need the concrete record (e.g. *Square) must hold a typed reference; they cannot recover it through this Value-level Unbox. This is sufficient for the type-identity/stringification contract RecordBase covers; field access on native records goes through the generated struct directly.
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) 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 (t *RecordType) TypeName() string
TypeName returns the record type name.
func (*RecordType) Unbox ¶
func (t *RecordType) Unbox() any
type Reduced ¶
type Reduced struct {
// contains filtered or unexported fields
}
Reduced wraps a value to signal early termination in reduce/transduce.
func NewReduced ¶
type Refer ¶
type Refer struct {
// contains filtered or unexported fields
}
Refer entries are immutable once constructed and inserted, so their fields (ns, all, only) may be read without holding the owning namespace's lock — only the refers MAP itself is mutex-guarded.
type Regex ¶
type Regex struct {
// contains filtered or unexported fields
}
Regex is boxed int
A Regex may be shared freely across goroutines/ExecContexts: regex literals compile once at read time into constants visible to all threads, which is safe because every method below is a read-only matching API (Go's regexp is goroutine-safe except mutating config like Longest). Never add a mutating configuration method here without copy-on-write (regexp.Copy).
func MustRegexFromReadable ¶ added in v1.12.0
MustRegexFromReadable reconstructs a Regex from its readable #"..." form (String()'s output: '#' followed by a Go-quoted pattern). Generated code uses it to rebuild read-time-compiled regex literal constants; the pattern was validated at read time, so failure here indicates a codegen bug.
func (*Regex) FindAllStringSubmatch ¶
func (*Regex) FindAllStringSubmatchIndex ¶ added in v1.12.0
func (*Regex) FindStringSubmatch ¶
func (*Regex) FindStringSubmatchIndex ¶ added in v1.12.0
func (*Regex) ReplaceAllFunc ¶ added in v1.11.0
func (l *Regex) ReplaceAllFunc(s string, f func(groups []string, present []bool) (string, error)) (string, error)
ReplaceAllFunc replaces every non-overlapping match using f, matching clojure.string/replace with a function replacement. For each match, f receives the submatch groups: groups[0] is the whole match, groups[i] the i-th capture group; present[i] is false for a group that did not participate (so the caller can pass nil, as Clojure's re-groups does).
func (*Regex) ReplaceFirst ¶ added in v1.10.0
ReplaceFirst replaces only the first match, expanding $-group references in the replacement (as ReplaceAll does), matching clojure.string/replace-first.
type Repeat ¶
type Repeat struct {
// contains filtered or unexported fields
}
Repeat is a Value whose only value is Repeat
type Scope ¶ added in v1.9.0
type Scope struct {
// contains filtered or unexported fields
}
func OpenChildEC ¶ added in v1.11.0
func OpenChildEC(ec *ExecContext) *Scope
OpenChildEC opens a child of ec's current scope and installs it on ec for a synchronous dynamic extent (the with-scope body, which runs in the same frame, hence the same ec). It returns the child; pair with CloseScoped, which runs the restore that reinstates the previous scope. This is the explicit-context replacement for the old goroutine-id-keyed OpenChild.
func (*Scope) Await ¶ added in v1.9.0
Await blocks until every goroutine in this scope AND its subtree has exited, or timeout elapses. Returns true if fully drained, false on timeout. A non-positive timeout waits indefinitely.
func (*Scope) Cancel ¶ added in v1.9.0
func (s *Scope) Cancel()
Cancel cancels this scope's context — and, by context inheritance, its whole subtree — without installing a fresh one. Terminal: the scope stops accepting new cancellable work. Siblings are unaffected. Does not wait; pair with Await (or use Shutdown).
func (*Scope) CancelAll ¶ added in v1.9.0
func (s *Scope) CancelAll()
CancelAll cancels the current context generation and installs a fresh one derived from the parent, so the scope can keep accepting spawns after a drain. This is the "drain and continue" form used by the root between benchmark iterations / at soft shutdown points. Lock-free: the fresh generation is swapped in atomically and we cancel whatever we displaced, so concurrent CancelAlls are safe.
func (*Scope) Child ¶ added in v1.9.0
Child creates a sub-scope whose context is derived from this scope's current context. Cancelling this scope (or any ancestor) cancels the child; cancelling the child leaves this scope and its siblings running.
func (*Scope) Context ¶ added in v1.9.0
Context returns the scope's current cancellation context. Blocking native ops (sleep, channel send/recv, alts!) select on its Done() so they unblock when the scope is cancelled. Lock-free (one atomic load), cheap to call on every channel op.
func (*Scope) Drain ¶ added in v1.9.0
Drain cancels the scope's current generation and reinstalls a fresh one (so the scope keeps working), then waits for the displaced work to exit. Used by the root between bench iterations and at soft shutdown.
func (*Scope) Go ¶ added in v1.9.0
Go runs fn in a tracked goroutine of THIS scope. fn receives the scope's current context; long-running work should select on ctx.Done() so Cancel/Shutdown/Drain can stop it.
func (*Scope) Live ¶ added in v1.9.0
Live reports how many goroutines are running directly in this scope (not counting sub-scopes). Use LiveTree for the whole subtree.
func (*Scope) LiveTree ¶ added in v1.9.0
LiveTree reports the live goroutine count of this scope and all descendants.
func (*Scope) Shutdown ¶ added in v1.9.0
Shutdown cancels this scope (terminal, cascades to the subtree) and waits up to timeout for it to drain. The structured-shutdown form for a sub-scope; for the root's drain-and-continue use Drain.
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) Conj ¶ added in v1.8.0
func (s *SetWithMeta) Conj(value Value) Collection
func (*SetWithMeta) Meta ¶
func (s *SetWithMeta) Meta() Value
func (*SetWithMeta) WithMeta ¶
func (s *SetWithMeta) WithMeta(m Value) Value
type SortedMap ¶ added in v1.5.0
type SortedMap struct {
// contains filtered or unexported fields
}
func NewSortedMap ¶ added in v1.5.0
func NewSortedMap(cmp Comparator, kvs []Value) *SortedMap
func (*SortedMap) Assoc ¶ added in v1.5.0
func (m *SortedMap) Assoc(key, val Value) Associative
func (*SortedMap) Conj ¶ added in v1.5.0
func (m *SortedMap) Conj(value Value) Collection
func (*SortedMap) Dissoc ¶ added in v1.5.0
func (m *SortedMap) Dissoc(key Value) Associative
func (*SortedMap) Empty ¶ added in v1.5.0
func (m *SortedMap) Empty() Collection
type SortedMapSeq ¶ added in v1.5.0
type SortedMapSeq struct {
// contains filtered or unexported fields
}
SortedMapSeq implements Seq over sorted map entries.
func (*SortedMapSeq) Cons ¶ added in v1.5.0
func (s *SortedMapSeq) Cons(val Value) Seq
func (*SortedMapSeq) Count ¶ added in v1.5.0
func (s *SortedMapSeq) Count() Value
func (*SortedMapSeq) First ¶ added in v1.5.0
func (s *SortedMapSeq) First() Value
func (*SortedMapSeq) More ¶ added in v1.5.0
func (s *SortedMapSeq) More() Seq
func (*SortedMapSeq) Next ¶ added in v1.5.0
func (s *SortedMapSeq) Next() Seq
func (*SortedMapSeq) RawCount ¶ added in v1.5.0
func (s *SortedMapSeq) RawCount() int
func (*SortedMapSeq) String ¶ added in v1.5.0
func (s *SortedMapSeq) String() string
func (*SortedMapSeq) Type ¶ added in v1.5.0
func (s *SortedMapSeq) Type() ValueType
func (*SortedMapSeq) Unbox ¶ added in v1.5.0
func (s *SortedMapSeq) Unbox() any
type SortedSet ¶ added in v1.5.0
type SortedSet struct {
// contains filtered or unexported fields
}
func NewSortedSet ¶ added in v1.5.0
func NewSortedSet(cmp Comparator, vals []Value) *SortedSet
func (*SortedSet) Conj ¶ added in v1.5.0
func (s *SortedSet) Conj(value Value) Collection
func (*SortedSet) Empty ¶ added in v1.5.0
func (s *SortedSet) Empty() Collection
type SortedSetSeq ¶ added in v1.5.0
type SortedSetSeq struct {
// contains filtered or unexported fields
}
func (*SortedSetSeq) Cons ¶ added in v1.5.0
func (s *SortedSetSeq) Cons(val Value) Seq
func (*SortedSetSeq) Count ¶ added in v1.5.0
func (s *SortedSetSeq) Count() Value
func (*SortedSetSeq) First ¶ added in v1.5.0
func (s *SortedSetSeq) First() Value
func (*SortedSetSeq) More ¶ added in v1.5.0
func (s *SortedSetSeq) More() Seq
func (*SortedSetSeq) Next ¶ added in v1.5.0
func (s *SortedSetSeq) Next() Seq
func (*SortedSetSeq) RawCount ¶ added in v1.5.0
func (s *SortedSetSeq) RawCount() int
func (*SortedSetSeq) String ¶ added in v1.5.0
func (s *SortedSetSeq) String() string
func (*SortedSetSeq) Type ¶ added in v1.5.0
func (s *SortedSetSeq) Type() ValueType
func (*SortedSetSeq) Unbox ¶ added in v1.5.0
func (s *SortedSetSeq) Unbox() any
type SourceInfo ¶
type SourceInfo struct {
File string
Line int // 0-based
Column int // 0-based
EndLine int
EndColumn int
Symbol string
}
SourceInfo tracks the source location of a form.
Symbol is an optional user-visible name for the value the form binds (e.g. a let-binding or parameter name). It is empty for SourceInfos attached purely for line/column tracking, and populated by the IR builder when a value flows through a `bind-local!` site so downstream passes (notably lower-go) can emit human-readable identifiers.
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.
It can be built eagerly (Add/Reserve) or lazily: NewLazySourceMap holds a decode closure that is run at most once, on the first Lookup/Entries. Bundle load decodes every chunk's source map, yet source maps are only read on an error or stack-trace — so deferring the decode removes that allocation from the hot startup path entirely for the common (no-error) case.
func NewLazySourceMap ¶ added in v1.12.0
func NewLazySourceMap(decode func() []SourceMapEntry) *SourceMap
NewLazySourceMap returns a SourceMap whose entries are produced by `decode` on first access. `decode` runs at most once (memoized); it must be safe to call from any goroutine that first touches the map.
func NewLazySourceMapRaw ¶ added in v1.12.0
NewLazySourceMapRaw returns a SourceMap that decodes `count` entries from the raw LGB source-map bytes on first access. Each entry is 6 unsigned LEB128 varints: startIP, file(index into strings), line, col, endLine, endColumn. `raw` may alias the bundle buffer (read-only) and `strings` the module string table — both are retained, not copied.
func NewSourceMapWithCapacity ¶ added in v1.11.1
NewSourceMapWithCapacity creates an empty SourceMap with preallocated storage for n entries.
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.
func (*SourceMap) Reserve ¶ added in v1.11.1
Reserve grows the backing array so that n subsequent Add calls do not reallocate. The decoder knows the entry count up front (it reads a counted section), so a single sized allocation replaces O(n) append-growth garbage — the dominant source of startup heap churn.
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
func (String) InvokeMethod ¶ added in v1.8.0
func (String) String ¶
String returns the EDN/Clojure-readable form: surrounded by double quotes with EDN-conformant escapes. NOTE: Go's %q emits \xNN / \a / \v for control chars, which the reader rejects ("unknown escape sequence \x") and which are not valid EDN — so %q did not round-trip its own output (e.g. ANSI-colored strings like "\x1b[32m..."). Escapes here match the reader's accepted set (reader.go): \" \\ \t \r \n \b \f, and \uXXXX for everything else below 0x20 plus DEL; printable Unicode passes through as raw UTF-8.
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 any) 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 any) *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 ¶
FuzzySymbolLookup collects every symbol visible from ns whose name starts with s. Visibility matches Lookup: the ns's own registry, then the referred set (baseline auto-refers, explicit :refer / :refer [only], private filtering, and the ns-unmap tombstone — see referredSymbolsPrefix). Refer is not transitive — a cyclic refer graph cannot make this recurse.
Locals are merged on top of the referred set so a re-Def after ns-unmap still completes (Lookup checks the registry before refers; the tombstone only hides refer resolution), and a locally-def'd name that shadows a referred one appears once.
func (Symbol) Invoke ¶ added in v1.13.0
Invoke makes symbols callable for collection lookup, like keywords: ('a {'a 1}) → 1, ('a #{'a}) → 'a. Plain Lookup only — symbols have no KeywordLookup-style fast path.
func (Symbol) Namespaced ¶
func (Symbol) NamespacedRaw ¶ added in v1.12.0
NamespacedRaw splits "ns/name" WITHOUT allocating: IndexByte finds the separator and the two parts are substrings (which share the receiver's string backing — no new allocation), returned as raw Symbols rather than boxed into Value interfaces. hasNS is false for an unqualified symbol and for the bare "/" symbol. This is the hot path — it does NOT touch the lookup-stats mutex; the boxing Namespaced() below carries that.
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.
Like its persistent counterpart it has two modes: an insertion-ordered array-map mode (hamt == false, entries in okvs) used while the map stays at or below arrayMapMaxEntries, and the HAMT mode past that. This keeps the into/transduce path order-preserving for small maps, matching Clojure's transient array maps.
func NewTransientMap ¶
func NewTransientMap(m *PersistentMap) *TransientMap
func (*TransientMap) Arity ¶ added in v1.6.0
func (t *TransientMap) Arity() int
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) Contains ¶ added in v1.6.0
func (t *TransientMap) Contains(key Value) Boolean
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) Invoke ¶ added in v1.6.0
func (t *TransientMap) Invoke(args []Value) (Value, error)
func (*TransientMap) Persistent ¶
func (t *TransientMap) Persistent() (*PersistentMap, error)
Persistent freezes the transient and returns an immutable PersistentMap.
func (*TransientMap) RawCount ¶
func (t *TransientMap) RawCount() int
func (*TransientMap) Seq ¶ added in v1.11.1
func (t *TransientMap) Seq() Seq
func (*TransientMap) String ¶
func (t *TransientMap) String() string
func (*TransientMap) Type ¶
func (t *TransientMap) Type() ValueType
func (*TransientMap) Unbox ¶
func (t *TransientMap) Unbox() any
func (*TransientMap) ValueAt ¶
func (t *TransientMap) ValueAt(key Value) Value
ValueAt for lookups during construction.
type TransientSet ¶ added in v1.6.0
type TransientSet struct {
// contains filtered or unexported fields
}
TransientSet is a mutable version of PersistentSet for batch ops.
func NewTransientSet ¶ added in v1.6.0
func NewTransientSet(s *PersistentSet) *TransientSet
func (*TransientSet) Arity ¶ added in v1.6.0
func (t *TransientSet) Arity() int
func (*TransientSet) Conj ¶ added in v1.6.0
func (t *TransientSet) Conj(value Value) (*TransientSet, error)
func (*TransientSet) Contains ¶ added in v1.6.0
func (t *TransientSet) Contains(key Value) Boolean
func (*TransientSet) Count ¶ added in v1.6.0
func (t *TransientSet) Count() Value
func (*TransientSet) Disj ¶ added in v1.6.0
func (t *TransientSet) Disj(value Value) (*TransientSet, error)
func (*TransientSet) Invoke ¶ added in v1.6.0
func (t *TransientSet) Invoke(args []Value) (Value, error)
func (*TransientSet) Persistent ¶ added in v1.6.0
func (t *TransientSet) Persistent() (*PersistentSet, error)
func (*TransientSet) RawCount ¶ added in v1.6.0
func (t *TransientSet) RawCount() int
func (*TransientSet) String ¶ added in v1.6.0
func (t *TransientSet) String() string
func (*TransientSet) Type ¶ added in v1.6.0
func (t *TransientSet) Type() ValueType
func (*TransientSet) Unbox ¶ added in v1.6.0
func (t *TransientSet) Unbox() any
func (*TransientSet) ValueAt ¶ added in v1.6.0
func (t *TransientSet) ValueAt(key Value) Value
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 NewTransientVectorOfNils ¶ added in v1.13.0
func NewTransientVectorOfNils(n int) *TransientVector
NewTransientVectorOfNils returns an editable transient vector of n NIL slots in a single allocation. Callers that need an indexed scratch table (ir.direct's per-call value array) would otherwise build it as (vec (repeat n nil)) — a lazy seq walked element by element — which costs one cons per slot before the transient copy even starts.
func (*TransientVector) Arity ¶ added in v1.6.0
func (t *TransientVector) Arity() int
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) Contains ¶ added in v1.6.0
func (t *TransientVector) Contains(key Value) Boolean
func (*TransientVector) Count ¶
func (t *TransientVector) Count() Value
func (*TransientVector) Invoke ¶ added in v1.6.0
func (t *TransientVector) Invoke(args []Value) (Value, error)
func (*TransientVector) Nth ¶ added in v1.11.0
func (t *TransientVector) Nth(i int) Value
Nth implements Indexed: positional access by integer index. TransientVector is positional but not seqable, so `nth` must reach it through this rather than seq traversal.
func (*TransientVector) Persistent ¶
func (t *TransientVector) Persistent() (Value, error)
Persistent freezes the transient and returns an immutable vector.
func (*TransientVector) Pop ¶ added in v1.5.0
func (t *TransientVector) Pop() (*TransientVector, error)
Pop removes the last element from the transient 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() any
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 TypeUnion ¶ added in v1.12.0
type TypeUnion struct {
// contains filtered or unexported fields
}
TypeUnion is a reusable class/interface descriptor backed by several concrete let-go value types. It is a Value but deliberately not a ValueType: no runtime value has the union itself as its concrete type.
func NewTypeUnion ¶ added in v1.12.0
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) Nth ¶ added in v1.11.0
func (a *TypedArray) Nth(i int) Value
Nth implements Indexed: positional access by integer index.
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() any
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) Nth ¶ added in v1.11.0
func (s *TypedArraySeq) Nth(i int) Value
Nth implements Indexed: positional access by integer index.
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() any
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 UUID ¶ added in v1.5.0
type UUID struct {
// contains filtered or unexported fields
}
UUID holds a UUID string in canonical lowercase form.
type Value ¶
Value is implemented by all LETGO values
func ErrorToValue ¶ added in v1.11.0
ErrorToValue is the exported entry point used by gogen_ir-lowered Go code to convert a Go error returned by an invoked try body/handler into the catchable Value that a (catch e ...) handler binds. Mirrors the bytecode VM's handler path (vm.go handleError), so AOT-lowered try/catch sees the same caught value.
func MakeInt64 ¶ added in v1.13.0
MakeInt64 is MakeInt for arithmetic results: takes the full 64-bit value so a 32-bit-int host (TinyGo wasm) does not truncate it on the way in.
func MaybeDowngrade ¶
MaybeDowngrade returns an Int if the BigInt fits in int64, otherwise BigInt.
func MaybeSimplifyRatio ¶ added in v1.5.0
MaybeSimplifyRatio returns an Int/BigInt if denominator is 1, otherwise Ratio.
func MustBox ¶ added in v1.9.0
MustBox boxes a Go value via BoxValue and panics on error. Intended for use at init time (e.g. namespace install functions) where boxing failure is a programmer error, not a runtime condition.
func NewArrayVector ¶
func NewPersistentVector ¶
func NumAddP ¶ added in v1.8.0
NumAddP is `+` with overflow promotion for Int+Int. All other type combinations match NumAdd exactly. Delegating to NumAdd for the non-Int/Int paths is safe because NumAdd's BigInt branches return NewBigInt(...) directly (no MaybeDowngrade), preserving BigInt identity through `+'`. The same invariant is relied on by NumSubP and NumMulP below — if you change MaybeDowngrade usage in NumAdd/Sub/Mul, re-check the eval tests `(bigint? (+' 1 1N))` etc. NumNeg DOES downgrade *BigInt, hence the explicit branch in NumNegP. Naming mirrors Clojure JVM's `addP`/`multiplyP` precedent.
func NumMod ¶
NumMod computes the floored modulus (like Clojure's mod). Sign follows the divisor: (mod -10 3) => 2
func NumNegP ¶ added in v1.8.0
NumNegP is unary `-` with overflow promotion at math.MinInt64. For *BigInt we negate directly without downgrading — `(-' 1N)` must return `-1N`, not `Int -1` (Clojure preserves BigInt identity through promoting ops). NumNeg in pkg/vm/numbers.go does downgrade, hence the explicit BigInt branch here.
func NumRem ¶ added in v1.3.1
NumRem computes the remainder of truncated division (like Java's %). Sign follows the dividend: (rem -10 3) => -1
func NumUncheckedAdd ¶ added in v1.13.0
func NumUncheckedMultiply ¶ added in v1.13.0
func NumUncheckedSubtract ¶ added in v1.13.0
func RunWithBindings ¶ added in v1.8.0
func RunWithBindings(snap BindingSnapshot, fn func() (Value, error)) (Value, error)
RunWithBindings runs fn with snap installed as the root context's dynamic bindings, restoring the prior state afterwards. This is the legacy process-global bracketing used by spawn sites that have not yet moved to a child ExecContext; true per-goroutine isolation comes from running fn under ec.Child() instead (see docs/design/exec-context-threading.md).
func SeqToSlice ¶ added in v1.8.0
SeqToSlice realizes a let-go sequence value into a []Value. Useful when a Go caller has a vm.Value and explicitly wants a slice. Returns nil for nil/NIL/empty input. Returns an error if v isn't a sequence.
For infinite sequences this will not terminate — use Iter and break instead.
type Var ¶
type Var struct {
// contains filtered or unexported fields
}
func (*Var) AlterRootArgs ¶ added in v1.8.0
func (*Var) Deref ¶
Deref returns the current value in the root execution context: the dynamic top binding if one is active, else the root. Host and lowered callers that hold no ExecContext resolve here; the interpreter resolves against its frame's context via ExecContext.deref (which shares derefRoot for the root).
func (*Var) GuardDeviated ¶ added in v1.13.0
GuardDeviated reports whether this guarded var's current root differs from the canonical root captured by GuardRoot. Diagnostic use: identify which native primitive an intact-check failure attributes to.
func (*Var) GuardRoot ¶ added in v1.12.0
func (v *Var) GuardRoot()
GuardRoot marks the var's CURRENT root as the canonical value of a native primitive. Any later root mutation to a different value (with-redefs, alter-var-root, re-def) bumps the global deviation counter, steering lowered direct-call sites onto the trampoline until the root is restored.
func (*Var) IsBound ¶ added in v1.10.0
IsBound reports whether the var has any bound value — a root binding OR an active dynamic binding — matching Clojure's bound?. A var interned by the compiler for a forward `(def x v)` (before it runs) has neither yet, which distinguishes "declared but unset" from "set", as `defonce` needs.
func (*Var) MetaDeferred ¶ added in v1.13.0
MetaDeferred reports whether the var's metadata is still the lazy DefMetaPairs form, i.e. no map has been built for it yet.
func (*Var) NSRef ¶ added in v1.13.0
NSRef returns the namespace OBJECT this var was interned into (nil for vars constructed without one, e.g. some Go-side unit-test fixtures). Used to attach def's :ns metadata (spec 4.4) at runtime rather than baking a *Namespace into a compiled constant — see rt.ApplyVarMeta.
func (*Var) PopBinding ¶
func (v *Var) PopBinding()
PopBinding removes the most recent dynamic binding in the root context.
func (*Var) PushBinding ¶
PushBinding pushes a dynamic binding value in the root execution context.
func (*Var) RemoveWatch ¶ added in v1.8.0
func (*Var) Root ¶ added in v1.8.0
Root returns the var's root binding directly, bypassing any current dynamic binding on the stack. Use this where Clojure semantics require the root (e.g. alter-var-root) rather than the currently visible deref value.
func (*Var) SetDynamic ¶
func (v *Var) SetDynamic()
func (*Var) SetMetaPairs ¶ added in v1.13.0
SetMetaPairs defers construction of a PersistentMap for bundle metadata. The pairs originate in an immutable constant, so retaining its slice is safe.
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
¶
- allocattr.go
- ansi.go
- atom.go
- bigdecimal.go
- bigint.go
- binding_stack.go
- bool.go
- boxed.go
- boxed_reflect.go
- chan.go
- char.go
- chunk.go
- chunked_seq.go
- compare.go
- cons.go
- constpool.go
- def_meta_pairs.go
- deftype.go
- delay.go
- equals.go
- errfmt.go
- errors.go
- exception_class.go
- exec_context.go
- exinfo.go
- float.go
- func.go
- hash.go
- instant.go
- int.go
- invokable.go
- iter.go
- iterate.go
- keyword.go
- lazy_seq.go
- list.go
- lookup_stats.go
- map.go
- meta_value.go
- multifn.go
- namespace.go
- native_func.go
- native_func_reflect.go
- nil.go
- numbers.go
- numbers_promote.go
- numcache.go
- persistent_map.go
- persistent_queue.go
- persistent_set.go
- persistent_vector.go
- persistent_vector_chunked.go
- prepared_call.go
- profile.go
- promise.go
- protocol.go
- range.go
- range_chunked.go
- ratio.go
- record.go
- record_base.go
- reduced.go
- regex.go
- repeat.go
- root_bindings.go
- scope.go
- set.go
- sorted_map.go
- sorted_set.go
- source.go
- string.go
- struct_interop.go
- struct_mapping.go
- symbol.go
- trace.go
- transient.go
- type_union.go
- typed_array.go
- uuid.go
- value.go
- var.go
- vector.go
- vm.go
- void.go
- volatile.go