builtins

package
v1.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2026 License: MIT Imports: 2 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayMap added in v1.13.0

func ArrayMap(args ...vm.Value) (vm.Value, error)

lg:native lg:name array-map ArrayMap mirrors clojure.core/array-map — `(array-map & kvs)`.

func Cons

func Cons(elem, coll vm.Value) (vm.Value, error)

Cons mirrors clojure.core/cons — `(cons x coll)`.

func Contains

func Contains(coll, k vm.Value) (vm.Value, error)

lg:native lg:name contains? Contains mirrors clojure.core/contains? — `(contains? coll k)`.

func HashSet added in v1.13.0

func HashSet(args ...vm.Value) (vm.Value, error)

lg:native HashSet mirrors clojure.core/hash-set — `(hash-set & xs)`.

func IsSeq added in v1.13.0

func IsSeq(v vm.Value) (vm.Value, error)

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 Not

func Not(v vm.Value) (vm.Value, error)

Not mirrors clojure.core/not — `(not x)`.

func Nth added in v1.13.0

func Nth(coll, i vm.Value) (vm.Value, error)

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

func Nth3(coll, i, notFound vm.Value) (vm.Value, error)

lg:native lg:name nth Nth3 mirrors clojure.core/nth — `(nth coll i notFound)`. Takes vm.Value arguments and handles type conversion internally.

func Vec added in v1.13.0

func Vec(coll vm.Value) (vm.Value, error)

lg:native Vec mirrors clojure.core/vec — `(vec coll)`.

func Vector

func Vector(args ...vm.Value) (vm.Value, error)

Vector mirrors clojure.core/vector — `(vector & xs)`. Builtin is vm.NativeFnType.WrapNoErr(vm.NewArrayVector); same delegation as List.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL