stdlib

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(vals ...float64) float64

Add returns sum of all the arguments.

func Conditional

func Conditional(scope parens.Scope, exprs []parens.Expr) (interface{}, error)

Conditional is commonly know LISP (cond (test1 act1)...) construct. Tests can be any exressions that evaluate to non-nil and non-false value.

func Defn

func Defn(scope parens.Scope, exprs []parens.Expr) (interface{}, error)

Defn macro is for defining named functions. It defines a lambda and binds it with the given name into the scope.

func Div

func Div(vals ...float64) float64

Div divides from left to right.

func Do

func Do(scope parens.Scope, exprs []parens.Expr) (interface{}, error)

Do executes all s-exps one by one and returns the result of last evaluation.

func Doc

func Doc(scope parens.Scope, exprs []parens.Expr) (interface{}, error)

Doc shows doc string associated with a symbol. If not found, returns a message.

func Eq

func Eq(vals ...interface{}) bool

Eq checks if lval is same as rval

func Eval added in v0.0.7

func Eval(env parens.Scope) func(val interface{}) interface{}

Eval returns the (eval <val>) function.

func Global

func Global(scope parens.Scope, exprs []parens.Expr) (interface{}, error)

Global binds the result of evaluating second argument to the symbol passed in as first argument in the global scope.

func Gt

func Gt(lval, rval float64) bool

Gt checks if lval is greater than rval

func Inspect

func Inspect(scope parens.Scope, exprs []parens.Expr) (interface{}, error)

Inspect dumps the exprs in a formatted manner.

func Label

func Label(scope parens.Scope, exprs []parens.Expr) (interface{}, error)

Label binds the result of evaluating second argument to the symbol passed in as first argument in the current scope.

func Lambda

func Lambda(scope parens.Scope, exprs []parens.Expr) (interface{}, error)

Lambda macro is for defining lambdas. (lambda (params) body)

func Let

func Let(scope parens.Scope, exprs []parens.Expr) (interface{}, error)

Let creates a new sub-scope from the global scope and executes all the exprs inside the new scope. Once the Let block ends, all the names bound will be removed. In other words, Let is a Do with local scope.

func LoadFile added in v0.0.7

func LoadFile(env parens.Scope) func(file string) interface{}

LoadFile returns function that reads and executes a lisp file.

func Lt

func Lt(lval, rval float64) bool

Lt checks if lval is lesser than rval

func Mul

func Mul(vals ...float64) float64

Mul multiplies all numbers.

func Not

func Not(val interface{}) bool

Not returns true if val is nil or false value and false otherwise.

func Quote added in v1.0.0

func Quote(scope parens.Scope, exprs []parens.Expr) (interface{}, error)

Quote prevents the expr from being executed until unquoted.

func RegisterAll

func RegisterAll(scope parens.Scope) error

RegisterAll registers different built-in functions into the given scope.

func RegisterCore

func RegisterCore(scope parens.Scope) error

RegisterCore binds all the core macros and functions into the scope.

func RegisterIO

func RegisterIO(scope parens.Scope) error

RegisterIO binds input/output functions into the scope.

func RegisterMath

func RegisterMath(scope parens.Scope) error

RegisterMath binds basic math operators into the scope.

func RegisterSystem

func RegisterSystem(scope parens.Scope) error

RegisterSystem binds system functions into the scope.

func Sub

func Sub(vals ...float64) float64

Sub returns result of subtracting from left-to-right.

func ThreadFirst

func ThreadFirst(scope parens.Scope, exprs []parens.Expr) (interface{}, error)

ThreadFirst macro appends first evaluation result as first argument of next function call.

func ThreadLast

func ThreadLast(scope parens.Scope, exprs []parens.Expr) (interface{}, error)

ThreadLast macro appends first evaluation result as last argument of next function call.

Types

This section is empty.

Jump to

Keyboard shortcuts

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