variant

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2025 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Call

func Call(needList bool, name string, arglist any) any

Call calls a function.

func CallObject

func CallObject(needList bool, fn any, arglist any) any

CallObject calls a function object.

func Compare

func Compare(op token.Token, x, y any) bool

Compare compares two values.

func Eval

func Eval(v any) any

Eval evaluates a value.

func Float

func Float(v any) float64

Float converts a value to float64.

func InitUniverse

func InitUniverse(names ...string)

InitUniverse initializes the universe module with the specified modules.

func Int

func Int(v any) int

Int ensures a value is int. It doesn't convert float to int.

func List

func List(in []any) []any

List converts the matching result of (R % ",") to a flat list. R % "," means R *("," R)

func ListOp

func ListOp[T any](in []any, fn func(v any) T) []T

ListOp converts the matching result of (R % ",") to a flat list. R % "," means R *("," R)

func LogicOp

func LogicOp(op token.Token, x, y any) bool

LogicOp does a logic operation.

func MathOp

func MathOp(op token.Token, x, y any) any

MathOp does a math operation.

func RangeOp

func RangeOp(in []any, fn func(v any))

RangeOp travels the matching result of (R % ",") and call fn(result of R). R % "," means R *("," R)

func UnaryOp

func UnaryOp(op token.Token, x any) any

UnaryOp does a unary operation.

Types

type DelayValue

type DelayValue = func() any

DelayValue represents a delayed value.

type Module

type Module struct {
	Name string
	// contains filtered or unexported fields
}

Module represents a module.

func NewModule

func NewModule(name string) *Module

NewModule creates a new module.

func (*Module) Insert

func (p *Module) Insert(name string, v any)

Insert inserts an object into the module.

func (*Module) Lookup

func (p *Module) Lookup(name string) (v any, ok bool)

Lookup looks up an object in the module.

func (*Module) Merge

func (p *Module) Merge(mod *Module)

Merge merges a module into the current module.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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