Documentation
¶
Overview ¶
Package builtins is the single-source home for direct-call-eligible clojure.core builtins: context-free functions with uniform vm.Value signatures. Each function here is meant to be BOTH the interpreter registration (lang.go boxes it) AND the AOT direct-call target (lang.go registers it as a native module, generated code calls builtins.X directly).
It imports ONLY vm (never rt) so rt/lang.go can import it without a cycle — that layering is what lets lang.go register from these funcs instead of duplicating their bodies (the corefns/diff-test pattern this replaces).
Index ¶
- func ArrayMap(args ...vm.Value) (vm.Value, error)
- func Cons(elem, coll vm.Value) (vm.Value, error)
- func Contains(coll, k vm.Value) (vm.Value, error)
- func HashSet(args ...vm.Value) (vm.Value, error)
- func IsSeq(v vm.Value) (vm.Value, error)
- func Not(v vm.Value) (vm.Value, error)
- func Nth(coll, i vm.Value) (vm.Value, error)
- func Nth3(coll, i, notFound vm.Value) (vm.Value, error)
- func Vec(coll vm.Value) (vm.Value, error)
- func Vector(args ...vm.Value) (vm.Value, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArrayMap ¶ added in v1.13.0
lg:native lg:name array-map ArrayMap mirrors clojure.core/array-map — `(array-map & kvs)`.
func Contains ¶
lg:native lg:name contains? Contains mirrors clojure.core/contains? — `(contains? coll k)`.
func HashSet ¶ added in v1.13.0
lg:native HashSet mirrors clojure.core/hash-set — `(hash-set & xs)`.
func IsSeq ¶ added in v1.13.0
lg:native lg:name seq? IsSeq mirrors clojure.core/seq? — true only for values that are actually vm.Seq. The explicit negative cases come first because several collection types satisfy vm.Seq structurally while Clojure reports seq? false for them. Single source of truth: rt's ns.Def("seq?") delegates here.
func Nth ¶ added in v1.13.0
lg:native Nth mirrors clojure.core/nth — `(nth coll i)`. Takes vm.Value arguments and handles type conversion internally, avoiding the type-coercion bottleneck of the primitive rt.Nth.
func Nth3 ¶ added in v1.13.0
lg:native lg:name nth Nth3 mirrors clojure.core/nth — `(nth coll i notFound)`. Takes vm.Value arguments and handles type conversion internally.
Types ¶
This section is empty.