lib

package
v0.0.0-...-9cd5b15 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: BSD-2-Clause Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Or  = &logicSpec{impl("<form@or  tupl? bool>"), false, false, true}
	Ok  = &logicSpec{impl("<form@ok  tupl? bool>"), false, true, false}
	And = &logicSpec{impl("<form@and tupl? bool>"), true, true, false}
	Not = &logicSpec{impl("<form@not tupl? bool>"), true, true, true}
)
View Source
var (
	Eq    = &compSpec{impl("<form@eq any tupl bool>"), 0, false}
	Equal = &compSpec{impl("<form@equal any tupl bool>"), 0, false}
	Ne    = &compSpec{impl("<form@ne any tupl bool>"), 0, true}
	Lt    = &compSpec{impl("<form@lt <alt num str span time> tupl|_ bool>"), -1, false}
	Ge    = &compSpec{impl("<form@ge <alt num str span time> tupl|_ bool>"), -1, true}
	Gt    = &compSpec{impl("<form@gt <alt num str span time> tupl|_ bool>"), 1, false}
	Le    = &compSpec{impl("<form@le <alt num str span time> tupl|_ bool>"), 1, true}
)
View Source
var (
	In = &inSpec{impl("<form@in any tupl|list bool>"), false}
	Ni = &inSpec{impl("<form@ni any tupl|list bool>"), true}
)
View Source
var Abs = &absSpec{impl("<form@abs num@ _>")}
View Source
var Add = &addSpec{impl("<form@add num@ tupl?|num _>")}
View Source
var Call = &callSpec{impl("<form@call spec tupl|exp lit|_>")}
View Source
var Cat = &catSpec{impl("<form@cat tupl str>")}
View Source
var Core = exp.Builtins(make(Specs).Add(
	Or, And, Ok, Not, Err,
	Add, Sub, Mul, Div, Rem, Abs, Neg, Min, Max,
	Eq, Ne, Lt, Ge, Gt, Le, In, Ni, Equal,
	If, Swt, Df,
	Cat, Sep, Xelf, Json,
	Make, Sel, Len,
))

Core is a builtin environment with foundational specs.

View Source
var Df = &dfSpec{impl("<form@df tupl|@1 @1!>")}
View Source
var Div = &divSpec{impl("<form@div num@ tupl|num _>")}
View Source
var Do = &doSpec{impl("<form@do tupl|exp @>")}
View Source
var Err = &errSpec{impl("<form@err tupl?|exp @>")}
View Source
var Fn = &fnSpec{impl("<form@fn tupl?|tag|typ exp|@1 spec|@1>")}
View Source
var Fold = &foldSpec{impl("<form@fold list|@1 @2 <func @2 @1 @2> @2>"), false}
View Source
var Foldr = &foldSpec{impl("<form@foldr list|@1 @2 <func @2 @1 @2> @2>"), true}
View Source
var If = &ifSpec{impl("<form@if <tupl cond:any then:exp|@1> else:exp?|@1 @1>")}
View Source
var Json = &rawSpec{impl("<form@json any raw>"), true}
View Source
var Len = &lenSpec{impl("<form@len <alt? list keyr str raw> int>")}
View Source
var Make = &makeSpec{impl("<form@make typ tupl?|exp lit|_>")}
View Source
var Max = &maxSpec{impl("<form@max num@ tupl?|num _>")}
View Source
var Min = &minSpec{impl("<form@min num@ tupl?|num _>")}
View Source
var Mul = &mulSpec{impl("<form@mul num@ tupl?|num _>")}
View Source
var Mut = &mutSpec{impl("<form@mut any@ tupl?|exp _>")}
View Source
var Neg = &negSpec{impl("<form@neg num@ _>")}
View Source
var Range = &rangeSpec{impl("<form@range n:int f?:<func int @1> list|@1>")}
View Source
var Rem = &remSpec{impl("<form@rem int int int>")}
View Source
var Sel = &selSpec{impl("<form@sel sym <tupl?|alt str int> @>")}
View Source
var Sep = &sepSpec{impl("<form@sep str tupl str>")}
View Source
var Std = exp.Builtins(make(Specs).AddMap(Core).Add(
	Do, Call,
	With,
	Mut,
	Fn,
	Fold, Foldr, Range,
))

Std extends the core environment with commonly used specs.

View Source
var Sub = &subSpec{impl("<form@sub num@ tupl|num _>")}
View Source
var Swt = &swtSpec{impl("<form@swt @1 <tupl case:@1 then:exp|@2> else:exp?|@2 @2>")}
View Source
var With = &withSpec{impl("<form@with dot?:any lets:tupl?|tag exp|@1 @1>")}
View Source
var Xelf = &rawSpec{impl("<form@xelf any raw>"), false}

Functions

This section is empty.

Types

type DotEnv

type DotEnv struct {
	Par  exp.Env
	Dot  lit.Val
	Lets *lit.Obj
}

DotEnv is a child scope that supports relative paths into either a dot literals or name values.

func (*DotEnv) Lookup

func (e *DotEnv) Lookup(s *exp.Sym, p cor.Path, eval bool) (lit.Val, error)

func (*DotEnv) Parent

func (e *DotEnv) Parent() exp.Env

type FuncEnv

type FuncEnv struct {
	Par exp.Env
	Def lit.Keyed
	// contains filtered or unexported fields
}

func (*FuncEnv) Lookup

func (e *FuncEnv) Lookup(s *exp.Sym, p cor.Path, eval bool) (lit.Val, error)

func (*FuncEnv) Parent

func (e *FuncEnv) Parent() exp.Env

type Specs

type Specs map[string]exp.Spec

Specs is spec map helper that can be converted to a builtin environment.

func (Specs) Add

func (sm Specs) Add(ss ...exp.Spec) Specs

Add add all specs to this spec map.

func (Specs) AddMap

func (sm Specs) AddMap(m map[string]exp.Spec) Specs

AddMap add all specs for map m to this spec map.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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