exprbuiltins

package
v1.0.0-alpha.11 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package exprbuiltins is the one list of the reserved built-in expression functions Pulse registers in the shared expr-lang environment (ATTR_FORMULA, FILTER_EXPRESSION, total() arguments and OVERLAY_FORMULA).

Three sites read it and must never drift apart:

  • internal/processing registers one expr.Function per name (and its tests pin that every name has an implementation);
  • internal/processing's filter-precompute purity check treats every name as a pure function, so a filter calling one keeps the precompute fast path;
  • the root package's embedder validation refuses an ExprFunction claiming any name with PULSE_EXTENSION_NAME_RESERVED.

It is a stdlib-free leaf, so the root package and internal/processing both import it without a cycle and without the root reaching the engine.

Adding a function: append its name to [reserved] (keep the group comments), implement it in internal/processing's built-in table, and document it in the expression-language skill. The earlier set helpers (has_any, set_union, ...) and coef / lookup are deliberately absent: they predate the reservation and keep their shadowing semantics.

Index

Constants

View Source
const RefFunc = "ref"

RefFunc is the reserved built-in that reads a registered reference vector: ref("table", key).

Variables

This section is empty.

Functions

func IsReserved

func IsReserved(name string) bool

IsReserved reports whether name is a reserved built-in expression function.

func IsVectorPair

func IsVectorPair(name string) bool

IsVectorPair reports whether name is a reserved built-in that reads two numeric vectors position by position (dot, dist, cosine).

func MetricFunctionNames

func MetricFunctionNames() []string

MetricFunctionNames returns, in declaration order of [reserved], every reserved built-in that evaluates a registry metric.

func Names

func Names() []string

Names returns a copy of every reserved built-in name, in declaration order.

func OverlayAllowed

func OverlayAllowed(name string) bool

OverlayAllowed reports whether OVERLAY_FORMULA may call the reserved built-in name. It is false for every non-reserved name.

func OverlayNames

func OverlayNames() []string

OverlayNames returns a copy of the reserved built-ins OVERLAY_FORMULA may call, in declaration order.

func OverlayRefused

func OverlayRefused(name string) bool

OverlayRefused reports whether name is a reserved built-in that OVERLAY_FORMULA must refuse (reserved, but outside the overlay subset).

func PreservesLabels

func PreservesLabels(name string) bool

PreservesLabels reports whether the reserved built-in name returns a vector labelled exactly like its first argument (vcenter, vzscore, vnormalize).

func SetHelperNames

func SetHelperNames() []string

SetHelperNames returns a copy of the unreserved set helper names, in declaration order.

Types

type MetricFunction

type MetricFunction struct {
	Metric string
	Form   string
}

MetricFunction is the linalg/metric registry metric a reserved built-in evaluates and the form it answers in ("distance" or "similarity", the metric.Form spellings: this leaf imports nothing).

func Metric

func Metric(name string) (MetricFunction, bool)

Metric returns the registry metric the reserved built-in name evaluates; false for a name that evaluates none.

Jump to

Keyboard shortcuts

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