lisp

package
v0.0.0-...-6efbb68 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2015 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var False = Value{symbolValue, "false"}
View Source
var Nil = Value{nilValue, nil}
View Source
var True = Value{symbolValue, "true"}

Functions

This section is empty.

Types

type Builtin

type Builtin struct{}

func (Builtin) Add

func (Builtin) Add(vars ...Value) (Value, error)

func (Builtin) Car

func (Builtin) Car(vars ...Value) (Value, error)

func (Builtin) Cdr

func (Builtin) Cdr(vars ...Value) (Value, error)

func (Builtin) Cons

func (Builtin) Cons(vars ...Value) (Value, error)

func (Builtin) Display

func (Builtin) Display(vars ...Value) (Value, error)

func (Builtin) Eq

func (Builtin) Eq(vars ...Value) (Value, error)

func (Builtin) Gt

func (Builtin) Gt(vars ...Value) (Value, error)

func (Builtin) Gte

func (Builtin) Gte(vars ...Value) (Value, error)

func (Builtin) Lt

func (Builtin) Lt(vars ...Value) (Value, error)

func (Builtin) Lte

func (Builtin) Lte(vars ...Value) (Value, error)

func (Builtin) Mul

func (Builtin) Mul(vars ...Value) (Value, error)

func (Builtin) Sub

func (Builtin) Sub(vars ...Value) (Value, error)

type Cons

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

func (Cons) Eval

func (c Cons) Eval(scope ScopedVars) (val Value, err error)

func (Cons) Execute

func (cons Cons) Execute(scope ScopedVars) (Value, error)

func (Cons) Len

func (c Cons) Len() int

func (Cons) List

func (c Cons) List() bool

func (Cons) Map

func (c Cons) Map(f func(v Value) (Value, error)) ([]Value, error)

func (Cons) String

func (c Cons) String() string

func (Cons) Stringify

func (c Cons) Stringify() []string

func (Cons) Vector

func (c Cons) Vector() Vector

type Env

type Env map[string]Value

type Map

type Map interface {
	Get(key string) (Value, bool)
}

type Pattern

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

type Proc

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

func (Proc) Call

func (p Proc) Call(scope ScopedVars, params Vector) (val Value, err error)

func (Proc) String

func (p Proc) String() string

type Scope

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

func NewNestedScope

func NewNestedScope(parent *Scope) *Scope

func NewScope

func NewScope() *Scope

func (*Scope) AddEnv

func (s *Scope) AddEnv() *Env

func (*Scope) Create

func (s *Scope) Create(key string, value Value) Value

func (*Scope) DropEnv

func (s *Scope) DropEnv() *Env

func (*Scope) Dup

func (s *Scope) Dup() *Scope

func (*Scope) Env

func (s *Scope) Env() *Env

func (*Scope) Get

func (s *Scope) Get(key string) (val Value, ok bool)

func (*Scope) Set

func (s *Scope) Set(key string, value Value) Value

type ScopedVars

type ScopedVars interface {
	Get(key string) (Value, bool)
	Set(key string, val Value) Value
	Create(key string, val Value) Value
}

type Token

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

func (*Token) String

func (t *Token) String() string

func (*Token) Type

func (t *Token) Type() string

type Tokens

type Tokens []*Token

func NewTokens

func NewTokens(program string) (tokens Tokens)

func (Tokens) Expand

func (tokens Tokens) Expand() (result Tokens, err error)

Expand until there are no more expansions to do

func (Tokens) Parse

func (tokens Tokens) Parse() (cons Cons, err error)

type Value

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

func EvalString

func EvalString(line string, scope ScopedVars) (Value, error)

func MapValue

func MapValue(m Map) Value

func NumberValue

func NumberValue(n int64) Value

func StringValue

func StringValue(s string) Value

func (Value) Cons

func (v Value) Cons() Cons

func (Value) Eval

func (v Value) Eval(scope ScopedVars) (Value, error)

func (Value) Inspect

func (v Value) Inspect() string

func (Value) Interface

func (v Value) Interface() interface{}

func (Value) Number

func (v Value) Number() int64

func (Value) String

func (v Value) String() string

type Vector

type Vector []Value

func (Vector) Inspect

func (s Vector) Inspect() string

func (Vector) String

func (s Vector) String() string

Jump to

Keyboard shortcuts

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