{"modulePath":"github.com/glojurelang/glojure","version":"v0.7.25","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package runtime\n\n## Variables\n\n```go\nvar (\n\tSymbolUnquote       = lang.NewSymbol(\"clojure.core/unquote\")\n\tSymbolSpliceUnquote = lang.NewSymbol(\"splice-unquote\")\n\tSymbolNamespace     = lang.NewSymbol(\"ns\")\n\tSymbolInNamespace   = lang.NewSymbol(\"in-ns\")\n\tSymbolUserNamespace = lang.NewSymbol(\"user\")\n\tSymbolDot           = lang.NewSymbol(\".\")\n)\n```\n\n```go\nvar (\n\tDebug = false\n\n\tSymNS   = lang.NewSymbol(\"ns\")\n\tSymInNS = lang.NewSymbol(\"in-ns\")\n)\n```\n\n```go\nvar (\n\tCompiler = \u0026evalCompiler{}\n)\n```\n\n```go\nvar (\n\t// TODO: don't use a global RT instance; incurs overhead from dynamic lookup\n\t// of methods. Instead, generate direct calls to functions in this package.\n\tRT = \u0026RTMethods{}\n)\n```\n\n```go\nvar (\n\t// The current version of Glojure\n\tVersion = func() string {\n\t\tif version != \"\" {\n\t\t\treturn strings.TrimPrefix(version, \"v\")\n\t\t}\n\t\tinfo, ok := debug.ReadBuildInfo()\n\t\tif !ok {\n\t\t\treturn \"0.0.0\"\n\t\t}\n\t\tif info.Main.Version == \"\" || info.Main.Version == \"(devel)\" {\n\t\t\treturn \"0.0.0\"\n\t\t}\n\t\treturn strings.TrimPrefix(info.Main.Version, \"v\")\n\t}()\n)\n```\n\n## Functions\n\n```go\nfunc AddLoadPath(fs fs.FS)\n```\nAddLoadPath adds a filesystem to the load path.\n\n```go\nfunc CoreArityFn(fn lang.IFn) lang.ArityFn\n```\nCoreArityFn adapts a native IFn to the dispatch type of a compiled core function. Existing multi-arity roots already carry the exact arity table.\n\n```go\nfunc FoldPartition(mode PartitionFoldMode, fn, initial any, size int64, coll any) any\n```\nFoldPartition consumes a temporary positive, nonoverlapping partition. Groups remain persistent uncounted sequences, so a callback can retain them. Only the unobservable outer lazy sequence and its thunks disappear.\n\n```go\nfunc GetNSLoader(nsResource string) func()\n```\nGetNSLoader retrieves the loader function for a namespace given its resource name.\n\n```go\nfunc GetUseAOT() bool\n```\n\n```go\nfunc IsDefaultCoreVar(vr *lang.Var) bool\n```\nIsDefaultCoreVar reports whether vr still has the standard root installed during runtime initialization. Generated optimizations use this guard before replacing higher-order core operations whose Vars remain redefinable.\n\n```go\nfunc MatchLiteralRegexp(pattern *regexp.Regexp, value any) any\n```\nMatchLiteralRegexp receives a pattern anchored by the code generator. Patterns without captures need only a match bit, avoiding submatch arrays.\n\n```go\nfunc NewEnvironment(opts ...EvalOption) lang.Environment\n```\n\n```go\nfunc OpenURL(u *url.URL) (io.ReadCloser, error)\n```\nOpenURL opens a non-file URL using the registered implementation.\n\n```go\nfunc PrepareReplaceLast(collection any) replaceLastPlan\n```\nPrepareReplaceLast prepares the collection side of a fused pop/conj.\n\n```go\nfunc RTReadString(s string) any\n```\n\n```go\nfunc ReadEval(code string, options ...ReadEvalOption) interface{}\n```\nReadEval reads and evaluates a string that may contain one or more forms in the global environment.\n\n```go\nfunc ReadLine(input io.Reader) any\n```\nReadLine avoids buffering past the line, preserving subsequent reads from the same stream even when callers mix read-line with other reader APIs.\n\n```go\nfunc ReduceInt64Pipeline(\n\tinitial int64,\n\tcoll interface{},\n\ttransforms []ReducePipelineTransformKind,\n\ttakeLimit int64,\n) interface{}\n```\nReduceInt64Pipeline applies an ephemeral, proven-int64 sequence pipeline directly while summing its source. The analyzer calls it only for a constant integer range after guarding every participating core Var.\n\n```go\nfunc RegisterCoreNativeLinks(refresh func())\n```\nRegisterCoreNativeLinks is emitted by the core AOT loader. Bootstrap refreshes those direct calls once after installing context-free native roots. Later user redefinitions retain the normal direct-linking policy.\n\n```go\nfunc RegisterNSLoader(nsResource string, loader func())\n```\nRegisterNSLoader registers a loader function for a namespace given its resource name (i.e. root path with slashes, no extension).\n\n```go\nfunc RegisterURLOpener(opener URLOpener)\n```\nRegisterURLOpener installs the process-wide implementation used by glojure.go.io for non-file URLs. The most recent registration wins.\n\n```go\nfunc SetSourceTransformer(transformer lang.IFn)\n```\nSetSourceTransformer installs an embedding-specific source rewrite applied to dynamically loaded namespace resources before they are read. Passing nil removes the transformer.\n\n```go\nfunc VectorMap(fn, coll any) any\n```\nVectorMap consumes a temporary map sequence directly into its vector. Traverse through Seq rather than the source's reduction protocol: map promises sequence traversal even when a custom collection reduces differently.\n\n```go\nfunc VectorMapcatSeq(seqFn, coll any) any\n```\nVectorMapcatSeq avoids temporary map-entry vectors and lazy concatenation when the default seq function flattens an ordinary map into a vector. Other collections keep mapcat's existing chunking and sequence behavior.\n\n## Types\n\n```go\ntype EvalOption func(*evalOptions)\n```\n\n```go\nfunc WithLoadPath(path []string) EvalOption\n```\n\n```go\nfunc WithStderr(w io.Writer) EvalOption\n```\n\n```go\nfunc WithStdout(w io.Writer) EvalOption\n```\n\n```go\ntype Fn struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewFn(astNode *ast.Node, env lang.Environment) *Fn\n```\n\n```go\nfunc (fn *Fn) ASTNode() *ast.Node\n```\n\n```go\nfunc (fn *Fn) ApplyTo(args lang.ISeq) interface{}\n```\n\n```go\nfunc (fn *Fn) GetEnvironment() lang.Environment\n```\nGetEnvironment returns the captured environment for this function. This is used by the codegen system to access captured values.\n\n```go\nfunc (fn *Fn) Invoke(args ...interface{}) interface{}\n```\n\n```go\nfunc (fn *Fn) Invoke0() interface{}\n```\n\n```go\nfunc (fn *Fn) Invoke1(a0 interface{}) interface{}\n```\n\n```go\nfunc (fn *Fn) Invoke2(a0, a1 interface{}) interface{}\n```\n\n```go\nfunc (fn *Fn) Invoke3(a0, a1, a2 interface{}) interface{}\n```\n\n```go\nfunc (fn *Fn) Invoke4(a0, a1, a2, a3 interface{}) interface{}\n```\n\n```go\nfunc (*Fn) IsFnValue()\n```\n\n```go\nfunc (fn *Fn) Meta() lang.IPersistentMap\n```\n\n```go\nfunc (fn *Fn) WithMeta(meta lang.IPersistentMap) interface{}\n```\n\n```go\ntype Generator struct {\n\t// contains filtered or unexported fields\n}\n```\nGenerator handles the conversion of AST nodes to Go code\n\n```go\nfunc NewGenerator(w io.Writer) *Generator\n```\nNewGenerator creates a new code generator\n\n```go\nfunc (g *Generator) Generate(ns *lang.Namespace) error\n```\nGenerate takes a namespace and generates Go code that populates the same namespace\n\n```go\ntype PartitionFoldMode uint8\n```\n\n```go\nconst (\n\tPartitionFoldReduce PartitionFoldMode = iota\n\tPartitionFoldSome\n\tPartitionFoldEvery\n\tPartitionFoldNotAny\n\tPartitionFoldNotEvery\n)\n```\n\n```go\ntype Promise struct {\n\t// contains filtered or unexported fields\n}\n```\nPromise implements Clojure's promise semantics using Go sync primitives.\n\n```go\nfunc NewPromise() *Promise\n```\n\n```go\nfunc (p *Promise) ApplyTo(args lang.ISeq) any\n```\n\n```go\nfunc (p *Promise) Deref() any\n```\n\n```go\nfunc (p *Promise) DerefWithTimeout(timeoutMs int64, timeoutVal any) any\n```\n\n```go\nfunc (p *Promise) Invoke(args ...any) any\n```\n\n```go\nfunc (p *Promise) IsRealized() bool\n```\n\n```go\ntype RTEvalError struct {\n\tErr      error\n\tGLJStack []string\n\tGoStack  string\n}\n```\n\n```go\nfunc (e *RTEvalError) Error() string\n```\n\n```go\nfunc (e *RTEvalError) Is(err error) bool\n```\n\n```go\nfunc (e *RTEvalError) Unwrap() error\n```\n\n```go\ntype RTMethods struct {\n\t// contains filtered or unexported fields\n}\n```\nRT is a struct with methods that map to Clojure's RT class' static methods. This approach is used to make translation of core.clj to Glojure easier.\n\n```go\nfunc (rt *RTMethods) Aclone(x any) any\n```\n\n```go\nfunc (rt *RTMethods) Alength(x any) int\n```\n\n```go\nfunc (rt *RTMethods) BooleanCast(x any) bool\n```\n\n```go\nfunc (rt *RTMethods) ByteCast(x any) int8\n```\n\n```go\nfunc (rt *RTMethods) CharCast(x any) Char\n```\n\n```go\nfunc (rt *RTMethods) Contains(coll, key any) bool\n```\n\n```go\nfunc (rt *RTMethods) Dissoc(x any, k any) any\n```\n\n```go\nfunc (rt *RTMethods) Find(coll, key any) any\n```\n\n```go\nfunc (rt *RTMethods) FindVar(qualifiedSym *Symbol) *Var\n```\n\n```go\nfunc (rt *RTMethods) Get(coll, key any, notFound ...any) any\n```\nGet provides the clojure.lang.RT-compatible entry point referenced by the inherited inline definition of clojure.core/get.\n\n```go\nfunc (rt *RTMethods) IntCast(x any) int\n```\n\n```go\nfunc (rt *RTMethods) Load(scriptBase string)\n```\n\n```go\nfunc (rt *RTMethods) Munge(name string) string\n```\n\n```go\nfunc (rt *RTMethods) NextID() int\n```\n\n```go\nfunc (rt *RTMethods) Nth(x any, i int) any\n```\n\n```go\nfunc (rt *RTMethods) NthDefault(x any, i int, def any) any\n```\n\n```go\nfunc (rt *RTMethods) ObjectArray(sizeOrSeq any) any\n```\nObjectArray creates an array of objects (\\[]any)\n\n```go\nfunc (rt *RTMethods) Peek(x any) any\n```\n\n```go\nfunc (rt *RTMethods) Pop(x any) any\n```\n\n```go\nfunc (rt *RTMethods) ResolveFieldOrMethod(name string) (interface{}, bool)\n```\nResolveFieldOrMethod keeps the collection accessors used by rewritten clojure.core forms on direct Go calls instead of reflected bound methods.\n\n```go\nfunc (rt *RTMethods) Subs(s string, start int) string\n```\n\n```go\nfunc (rt *RTMethods) SubsEnd(s string, start, end int) string\n```\n\n```go\nfunc (rt *RTMethods) Subvec(v IPersistentVector, start, end any) IPersistentVector\n```\n\n```go\nfunc (rt *RTMethods) ToArray(coll any) any\n```\n\n```go\nfunc (rt *RTMethods) UncheckedCharCast(x any) Char\n```\n\n```go\ntype ReadEvalOption func(*readEvalOptions)\n```\nReadEvalOption is an option for ReadEval.\n\n```go\nfunc WithEnv(env lang.Environment) ReadEvalOption\n```\nWithEnv sets the environment to use for evaluation.\n\n```go\nfunc WithFilename(filename string) ReadEvalOption\n```\nWithFilename sets the filename to use for evaluation.\n\n```go\ntype ReducePipelineTransformKind uint8\n```\n\n```go\nconst (\n\tReducePipelineMapIdentity ReducePipelineTransformKind = iota\n\tReducePipelineMapInc\n\tReducePipelineMapDec\n\tReducePipelineMapSquare\n\tReducePipelineFilterOdd\n\tReducePipelineFilterEven\n\tReducePipelineFilterPos\n\tReducePipelineFilterNeg\n\tReducePipelineFilterZero\n)\n```\n\n```go\ntype URLOpener func(*url.URL) (io.ReadCloser, error)\n```\nURLOpener opens a non-file URL for reading.\n\n","path":"github.com/glojurelang/glojure/pkg/runtime","name":"runtime","synopsis":"","isRedistributable":true}
