types

package
v0.2.15 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertFrom added in v0.2.0

func ConvertFrom(from MalType) ([]MalType, MalType, error)

func Equal_Q

func Equal_Q(a, b MalType) bool

func False_Q

func False_Q(obj MalType) bool

func Keyword_Q

func Keyword_Q(obj MalType) bool

func Line added in v0.2.0

func Line(cursor *Position, message string) string

func NewKeyword

func NewKeyword(s string) string

Keywords

func Nil_Q

func Nil_Q(obj MalType) bool

Scalars

func Q added in v0.2.0

func Q[T any](obj MalType) bool

func Sequential_Q

func Sequential_Q(seq MalType) bool

func String_Q

func String_Q(obj MalType) bool

func True_Q

func True_Q(obj MalType) bool

Types

type Dereferable added in v0.2.0

type Dereferable interface {
	Deref(context.Context) (MalType, error)
}

Dereferable type

type EnvType

type EnvType interface {
	Find(key Symbol) EnvType
	Set(key Symbol, value MalType) MalType
	Get(key Symbol) (MalType, error)
	Remove(key Symbol) error
	RemoveNT(key Symbol) error
	Update(key Symbol, f func(MalType) (MalType, error)) (MalType, error)
	Symbols(newLine [][]rune, lastPartial string) [][]rune

	FindNT(key Symbol) EnvType
	SetNT(key Symbol, value MalType) MalType
	GetNT(key Symbol) (MalType, error)
}

type ExternalCall added in v0.2.0

type ExternalCall func(context.Context, []MalType) (MalType, error)

type Func

type Func struct {
	// Fn     func(context.Context, []MalType) (MalType, error)
	Fn     ExternalCall
	Meta   MalType
	Cursor *Position
}

Functions

type HashMap

type HashMap struct {
	Val    map[string]MalType
	Meta   MalType
	Cursor *Position
}

Hash Maps

func (HashMap) MarshalJSON

func (hm HashMap) MarshalJSON() ([]byte, error)

type LispPrintable added in v0.2.0

type LispPrintable interface {
	LispPrint(func(obj MalType, print_readably bool) string) string
}

LispPrintable type

type List

type List struct {
	Val    []MalType
	Meta   MalType
	Cursor *Position
}

Lists

func (List) MarshalJSON

func (l List) MarshalJSON() ([]byte, error)

type MalFunc

type MalFunc struct {
	Eval    func(context.Context, MalType, EnvType) (MalType, error)
	Exp     MalType
	Env     EnvType
	Params  MalType
	IsMacro bool
	GenEnv  func(EnvType, MalType, MalType) (EnvType, error)
	Meta    MalType
	Cursor  *Position
}

func (MalFunc) GetMacro

func (f MalFunc) GetMacro() bool

func (MalFunc) SetMacro

func (f MalFunc) SetMacro() MalType

type MalType

type MalType interface{}

General types

func Apply

func Apply(ctx context.Context, f_mt MalType, a []MalType) (MalType, error)

Take either a MalFunc or regular function and apply it to the arguments

func ConvertTo added in v0.2.0

func ConvertTo(from []MalType, _to MalType, meta MalType) (MalType, error)

func GetSlice

func GetSlice(seq MalType) ([]MalType, error)

func NewHashMap

func NewHashMap(seq MalType) (MalType, error)

func NewList

func NewList(a ...MalType) MalType

type Placeholder added in v0.2.0

type Placeholder struct {
	Index  int
	Cursor *Position
}

Placeholder

type Position

type Position struct {
	Module   *string
	BeginRow int
	BeginCol int
	Row      int
	Col      int
}

func NewAnonymousCursorHere added in v0.2.0

func NewAnonymousCursorHere(row, col int) *Position

func NewCursor added in v0.2.0

func NewCursor() *Position

func NewCursorFile added in v0.2.0

func NewCursorFile(module string) *Position

func NewCursorHere added in v0.2.0

func NewCursorHere(moduleName string, row, col int) *Position

func (*Position) Close added in v0.2.0

func (c *Position) Close(here *Position) *Position

func (*Position) Copy added in v0.2.0

func (p *Position) Copy() *Position

func (*Position) Here added in v0.2.0

func (p *Position) Here(here *Position) *Position

func (*Position) Includes added in v0.2.0

func (cursor *Position) Includes(inside Position) bool

func (*Position) SetPos added in v0.2.0

func (p *Position) SetPos(row int) *Position

func (*Position) String added in v0.2.0

func (cursor *Position) String() string

func (*Position) StringModule added in v0.2.0

func (cursor *Position) StringModule() string

func (*Position) StringPosition added in v0.2.0

func (cursor *Position) StringPosition() string

func (*Position) StringPositionRow added in v0.2.0

func (cursor *Position) StringPositionRow() string

type Set added in v0.2.0

type Set struct {
	Val    map[string]struct{}
	Meta   MalType
	Cursor *Position
}

Sets

func NewSet added in v0.2.0

func NewSet(seq MalType) (Set, error)

func (Set) MarshalJSON added in v0.2.0

func (s Set) MarshalJSON() ([]byte, error)

type Symbol

type Symbol struct {
	Val    string
	Cursor *Position
}

Symbols

type Token

type Token struct {
	Value  string
	Type   rune
	Cursor Position
}

func (Token) GetPosition added in v0.2.0

func (token Token) GetPosition() *Position

type Typed added in v0.2.0

type Typed interface {
	Type() string
}

type Vector

type Vector struct {
	Val    []MalType
	Meta   MalType
	Cursor *Position
}

Vectors

func (Vector) MarshalJSON

func (v Vector) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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