std

package
v0.0.0-...-7e8a755 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2020 License: BSD-2-Clause Imports: 8 Imported by: 5

Documentation

Overview

Package std provides built-in expression resolvers.

Index

Constants

This section is empty.

Variables

View Source
var ErrExpectNumer = cor.StrError("expected numer argument")

Std is an environment that includes both the Core and Decl lookup function.

Functions

func Core

func Core(sym string) *exp.Spec

Core is a resolver lookup for all standard forms, not involving declarations or functions.

Logic forms:

and, or, bool, not, if

Arithmetic forms:

add, mul, sub, div, rem, abs, neg, min, max

Comparison forms:

eq, ne, equal, in, ni, lt, le, gt, ge

Other forms:

len, with, dyn, con, cat, apd, set

func Decl

func Decl(sym string) *exp.Spec

Decl is a resolver lookup for the declaration and container forms.

Declaration forms:

let and fn

Container forms:

fst, lst, nth, filter, map, fold, foldr

func DefaultResl

func DefaultResl(x CallCtx) (exp.El, error)

func SpecDX

func SpecDX(sig string, x Evaler) *exp.Spec

func SpecDXX

func SpecDXX(sig string, x Evaler) *exp.Spec

func SpecRX

func SpecRX(sig string, r, x Evaler) *exp.Spec

func SpecXX

func SpecXX(sig string, x Evaler) *exp.Spec

Types

type CallCtx

type CallCtx struct {
	*exp.Prog
	Env exp.Env
	*exp.Call
	Hint typ.Type
}

type Evaler

type Evaler func(CallCtx) (exp.El, error)

type SpecImpl

type SpecImpl struct {
	// contains filtered or unexported fields
}

func (*SpecImpl) Eval

func (r *SpecImpl) Eval(p *exp.Prog, env exp.Env, c *exp.Call, h typ.Type) (exp.El, error)

func (*SpecImpl) Resl

func (r *SpecImpl) Resl(p *exp.Prog, env exp.Env, c *exp.Call, h typ.Type) (exp.El, error)

Jump to

Keyboard shortcuts

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