slip

package module
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: MIT Imports: 30 Imported by: 0

README

Build Status Go Report Card

SLIce Processing is LISP for golang.

SLIP is a mostly Common LISP implementation lacking some features and including many non standard features. Most notable of the extra features is the ability to extend LISP with Go code. Also included is a Read Eval Print Loop (REPL) that provides an environment for prototyping, testing, and exploring SLIP. While not a full implemenation of Common LISP, SLIP continues to move in that direction.

A more detailed explanation of some of the features are on the features.md page.

Using

To use, first install then start the REPL with the slip application. A good place to start is to press ctrl-h for help. Then try out some LISP code. Two of the most help functions are apropos and describe. Press M-? or M-/ after a function name to get pop-up documentation.

▶ (apropos 'json)
bag:discover-json (built-in)
bag:json-parse (built-in)
▶ (describe 'car)
common-lisp:car
  [symbol]

car names a built-in:
  Lambda-List: (arg)
  Return: object
  Documentation:
    car returns the car if arg is a cons, the first element if arg is
    a list, and nil if arg is nil or an empty list.
  Arguments:
    arg: [list|cons]
      The value to take the first element of.

  Examples:
    (car nil) => nil
    (car '(a . b) => a
    (car '(a b c)) => a

The REPL includes many additional features such as muliple line editing, history, tab completion, and more.

Installation

Install using go get:

go get github.com/ohler55/slip/cmd/slip

Install using brew: (when the minimum popularity metrics are achieved)

# brew install slip

Releases

See CHANGELOG.md

Plugins

Plugins are available in other repositories.

  • slip-mongo for mongodb APIs.
  • slip-ggql for a GraphQL server.
  • slip-jet for JetStream messaging APIs (contact me if interested)
  • slip-message for simple NATS APIs (contact me if interested)
  • slip-flow a process flow implementation (contact me if interested)
  • flow-editor a process flow graphical editor (contact me if interested)
  • slip-parquet for parquet APIs (contact me if interested)

Contributing

Bug fix contributions are welcome. Please create a PR for any fixes. New features should be discussed first as the SLIP core generally follows the Common LISP specification as much as possible. SLIP can be extended with plugins and new features are often best offered with a separate plugin project. If you would like me to review a plugin just ask and I'll do my best to provide constructive comments.

On the subject of using AI, please realize that AI is just a tool and the final responsibility is you as a developer. Code that is clearly written by AI with developer cleanup or has the hallmarks of sloppy code will be rejected early.

Documentation

Overview

Package slip is an implementation of a LISP environment.

Index

Constants

View Source
const (
	ArraySymbol       = Symbol("array")
	ArrayMaxRank      = 1024
	ArrayMaxDimension = 0x10000000
)

ArraySymbol is the symbol with a value of "array".

View Source
const (
	// AmpBody is &body.
	AmpBody = "&body"
	// AmpKey is &key.
	AmpKey = "&key"
	// AmpOptional is &optional.
	AmpOptional = "&optional"
	// AmpRest is &rest.
	AmpRest = "&rest"
	// AmpAux is &aux.
	AmpAux = "&aux"
	// AmpAllowOtherKeys is &allow-other-keys
	AmpAllowOtherKeys = "&allow-other-keys"
)
View Source
const (
	// BuiltInSymbol is the symbol with a value of "built-in".
	BuiltInSymbol = Symbol("built-in")
	// FunctionSymbol is the symbol with a value of "function".
	FunctionSymbol = Symbol("function")
	// MacroSymbol is the symbol with a value of "macro".
	MacroSymbol = Symbol("macro")
	// LambdaSymbol is the symbol with a value of "lambda".
	LambdaSymbol = Symbol("lambda")
	// FlosSymbol is the symbol with a value of "flos-function" for FLOS functions.
	FlosSymbol = Symbol("flos-function")
	// MethodSymbol is the symbol with a value of "method" for Flavors
	// methods.
	MethodSymbol = Symbol("method")
	// GenericFunctionSymbol is the symbol with a value of "generic-function"
	// for CLOS generics and methods.
	GenericFunctionSymbol = Symbol("generic-function")
)
View Source
const (
	// ListSymbol is the symbol with a value of "list".
	ListSymbol = Symbol("list")

	// ConsSymbol is the symbol with a value of "cons".
	ConsSymbol = Symbol("cons")
)
View Source
const ArithmeticErrorSymbol = Symbol("arithmetic-error")

ArithmeticErrorSymbol is the symbol with a value of "arithmetic-error".

View Source
const BignumSymbol = Symbol("bignum")

BignumSymbol is the symbol with a value of "bignum".

View Source
const BitSymbol = Symbol("bit")

BitSymbol is the symbol with a value of "bit".

View Source
const BitVectorSymbol = Symbol("bit-vector")

BitVectorSymbol is the symbol with a value of "bit-vector".

View Source
const ByteSymbol = Symbol("byte")

ByteSymbol is the symbol with a value of "byte".

View Source
const CellErrorSymbol = Symbol("cell-error")

CellErrorSymbol is the symbol with a value of "cell-error".

View Source
const CharacterSymbol = Symbol("character")

CharacterSymbol is the Symbol with a value of "character".

View Source
const ClassNotFoundSymbol = Symbol("class-not-found")

ClassNotFoundSymbol is the symbol with a value of "unbound-slot".

View Source
const ComplexSymbol = Symbol("complex")

ComplexSymbol is the symbol with a value of "complex".

View Source
const ConditionSymbol = Symbol("condition")

ConditionSymbol is the symbol with a value of "condition".

View Source
const ControlErrorSymbol = Symbol("control-error")

ControlErrorSymbol is the symbol with a value of "control-error".

View Source
const (
	DefaultRightMargin = 120
)
View Source
const DivisionByZeroSymbol = Symbol("division-by-zero")

DivisionByZeroSymbol is the symbol with a value of "division-by-zero".

View Source
const DoubleFloatSymbol = Symbol("double-float")

DoubleFloatSymbol is the symbol with a value of "doubleFloat".

View Source
const EndOfFileSymbol = Symbol("end-of-file")

EndOfFileSymbol is the symbol with a value of "end-of-file".

View Source
const ErrorSymbol = Symbol("error")

ErrorSymbol is the symbol with a value of "error".

View Source
const FileErrorSymbol = Symbol("file-error")

FileErrorSymbol is the symbol with a value of "file-error".

View Source
const FileStreamSymbol = Symbol("file-stream")

FileStreamSymbol is the symbol with a value of "file-stream".

View Source
const FixnumSymbol = Symbol("fixnum")

FixnumSymbol is the symbol with a value of "fixnum".

View Source
const FloatSymbol = Symbol("float")

FloatSymbol is the symbol with a value of "float".

View Source
const HashTableSymbol = Symbol("hash-table")

HashTableSymbol is the symbol with a value of "hash-table".

View Source
const IOStreamSymbol = Symbol("io-stream")

IOStreamSymbol is the symbol with a value of "io-stream".

View Source
const InputStreamSymbol = Symbol("input-stream")

InputStreamSymbol is the symbol with a value of "input-stream".

View Source
const IntegerSymbol = Symbol("integer")

IntegerSymbol is the symbol with a value of "integer".

View Source
const InvalidMethodErrorSymbol = Symbol("invalid-method-error")

InvalidMethodErrorSymbol is the symbol with a value of "invalid-method-error".

View Source
const (
	LongFloatSymbol = Symbol("long-float")
)

LongFloatSymbol is the symbol with a value of "longFloat".

View Source
const NoApplicableMethodErrorSymbol = Symbol("no-applicable-method-error")

NoApplicableMethodErrorSymbol is the symbol with a value of "no-applicable-method-error".

View Source
const Novalue = novalue(0)

Novalue represents no value. It is used by built in functions such apropos that have no return value.

View Source
const NumberSymbol = Symbol("number")

NumberSymbol is the symbol with a value of "number".

View Source
const OctetSymbol = Symbol("octet")

OctetSymbol is the symbol with a value of "octet".

View Source
const OctetsSymbol = Symbol("octets")

OctetsSymbol is the symbol with a value of "octets".

View Source
const OutputStreamSymbol = Symbol("output-stream")

OutputStreamSymbol is the symbol with a value of "output-stream".

View Source
const PackageErrorSymbol = Symbol("package-error")

PackageErrorSymbol is the symbol with a value of "package-error".

View Source
const PackageSymbol = Symbol("package")

PackageSymbol is the symbol with a value of "package".

View Source
const ParseErrorSymbol = Symbol("parse-error")

ParseErrorSymbol is the symbol with a value of "parse-error".

View Source
const PrintNotReadableSymbol = Symbol("print-not-readable")

PrintNotReadableSymbol is the symbol with a value of "print-not-readable".

View Source
const ProgramErrorSymbol = Symbol("program-error")

ProgramErrorSymbol is the symbol with a value of "program-error".

View Source
const RatioSymbol = Symbol("ratio")

RatioSymbol is the symbol with a value of "ratio".

View Source
const RationalSymbol = Symbol("rational")

RationalSymbol is the symbol with a value of "rational".

View Source
const ReaderErrorSymbol = Symbol("reader-error")

ReaderErrorSymbol is the symbol with a value of "reader-error".

View Source
const RealSymbol = Symbol("real")

RealSymbol is the symbol with a value of "real".

View Source
const SequenceSymbol = Symbol("sequence")

SequenceSymbol is the symbol with a value of "sequence".

View Source
const SeriousConditionSymbol = Symbol("serious-condition")

SeriousConditionSymbol is the symbol with a value of "serious-condition".

View Source
const ShortFloatSymbol = Symbol("short-float")

ShortFloatSymbol is the symbol with a value of "shortFloat".

View Source
const SignedByteSymbol = Symbol("signed-byte")

SignedByteSymbol is the symbol with a value of "signed-byte".

View Source
const SimpleSymbol = Symbol("simple")

SimpleSymbol is the symbol with a value of "simple".

View Source
const SingleFloatSymbol = Symbol("single-float")

SingleFloatSymbol is the symbol with a value of "singleFloat".

View Source
const StreamErrorSymbol = Symbol("stream-error")

StreamErrorSymbol is the symbol with a value of "stream-error".

View Source
const StreamSymbol = Symbol("stream")

StreamSymbol is the symbol with a value of "stream".

View Source
const StringStreamSymbol = Symbol("string-stream")

StringStreamSymbol is the symbol with a value of "string-stream".

View Source
const StringSymbol = Symbol("string")

StringSymbol is the symbol with a value of "string".

View Source
const SymbolSymbol = Symbol("symbol")

SymbolSymbol is the symbol with a value of "symbol".

View Source
const TimeSymbol = Symbol("time")

TimeSymbol is the symbol with a value of "time".

View Source
const True = boolean(true)

True is the true boolean value.

View Source
const TrueSymbol = Symbol("t")

TrueSymbol is the symbol with a value of "t".

View Source
const TypeErrorSymbol = Symbol("type-error")

TypeErrorSymbol is the symbol with a value of "type-error".

View Source
const Unbound = unbound(0)

Unbound indicates a variable is unbound.

View Source
const UnboundSlotSymbol = Symbol("unbound-slot")

UnboundSlotSymbol is the symbol with a value of "unbound-slot".

View Source
const UnboundVariableSymbol = Symbol("unbound-variable")

UnboundVariableSymbol is the symbol with a value of "unbound-variable".

View Source
const UndefinedFunctionSymbol = Symbol("undefined-function")

UndefinedFunctionSymbol is the symbol with a value of "undefined-function".

View Source
const UnsignedByteSymbol = Symbol("unsigned-byte")

UnsignedByteSymbol is the symbol with a value of "unsigned-byte".

View Source
const ValuesSymbol = Symbol("values")

ValuesSymbol is the symbol with a value of "values".

View Source
const VectorSymbol = Symbol("vector")

VectorSymbol is the symbol with a value of "vector".

View Source
const WarningSymbol = Symbol("warning")

WarningSymbol is the symbol with a value of "serious-condition".

View Source
const WhopLocSymbol = Symbol("whopper-location")

WhopLocSymbol is the symbol with a value of "whopLoc".

Variables

View Source
var (
	CLPkg = Package{
		Name:      "common-lisp",
		Nicknames: []string{"cl"},
		Doc:       "Home of symbols defined by the ANSI LISP language specification.",

		PreSet: DefaultPreSet,
		Locked: true,
		// contains filtered or unexported fields
	}

	// ErrorOutput backs *error-output*.
	ErrorOutput Object = (*FileStream)(os.Stderr)

	// StandardOutput backs *standard-output*.
	StandardOutput Object = (*FileStream)(os.Stdout)

	// TrqaceOutput backs *trace-output*.
	TraceOutput Object = (*FileStream)(os.Stdout)

	// StandardInput backs *standard-input*.
	StandardInput Object = (*FileStream)(os.Stdin)

	// WorkingDir *default-pathname-defaults*
	WorkingDir, _ = os.Getwd()

	// Interactive flag. If true then warnings are output to *standard-output*
	// otherwise they are output to *error-output*.
	Interactive bool

	// CurrentPackage is the current package.
	CurrentPackage *Package
)

CLPkg is the COMMON-LISP package.

View Source
var CurrentPackageLoadPath = ""

CurrentPackageLoadPath is the current load path and is used to set the LoadPath of a package when it is added. This is set and unset by the cl:require function.

View Source
var (
	KeywordPkg = Package{
		Name:      "keyword",
		Nicknames: []string{},
		Doc:       "Home of keyword symbols.",

		PreSet: keywordPreSet,
		// contains filtered or unexported fields
	}
)

KeywordPkg is the KEYWORD package.

View Source
var (
	// UserPkg is the common-lisp-user package.
	UserPkg = Package{
		Name:      "common-lisp-user",
		Nicknames: []string{"cl-user", "user"},
		Doc:       "The default package for user code and variables.",
		Imports:   map[string]*Import{},
		PreSet:    DefaultPreSet,
	}
)

Functions

func AddClassHook added in v1.3.1

func AddClassHook(id string, fun func(p *Package, key string))

AddClassHook add a hook that is called after a class is added.

func AddDefunHook added in v0.9.5

func AddDefunHook(id string, fun func(p *Package, key string))

AddDefunHook add a hook that is called after a function is added.

func AddPackage

func AddPackage(pkg *Package)

AddPackage adds a package.

func AddSetHook added in v0.9.5

func AddSetHook(id string, fun func(p *Package, key string))

AddSetHook adds a hook that is called after setting a variable or after a defvar or defparameter is called.

func AddUnsetHook added in v0.9.5

func AddUnsetHook(id string, fun func(p *Package, key string))

AddUnsetHook add a hook that is called when a variable is unset or removed.

func Append

func Append(b []byte, obj Object) []byte

Append an Object to a byte array using the global print variables.

func AppendDoc

func AppendDoc(b []byte, text string, indent, right int, ansi bool, firstIndent ...int) []byte

AppendDoc appends text after formatting and converting _ and __ either to ANSI underline and bold or is not ANSI removing them.

func ArithmeticPanic added in v0.7.0

func ArithmeticPanic(s *Scope, depth int, operation Object, operands List, format string, args ...any)

ArithmeticPanic raises a ArithmeticError (arithmetic-error) describing a arithmetic error.

func ByteFromReader added in v1.3.1

func ByteFromReader(r io.Reader) (b byte, err error)

ByteFromReader reads a byte.

func CellPanic added in v0.7.0

func CellPanic(s *Scope, depth int, name Object, format string, args ...any)

CellPanic raises a CellError (cell-error) describing a cell error.

func CheckArgCount added in v1.3.1

func CheckArgCount(s *Scope, depth int, obj Object, args List, mn, mx int)

CheckArgCount panics if the number of arguments is outside the range specified.

func CheckSendArgCount added in v1.3.1

func CheckSendArgCount(s *Scope, depth int, self Instance, method string, args List, mn, mx int)

CheckSendArgCount panics if the number of arguments is outside the range specified.

func ClassNotFoundPanic added in v0.7.0

func ClassNotFoundPanic(s *Scope, depth int, name Object, format string, args ...any)

ClassNotFoundPanic raises a ClassNotFound (unbound-slot) describing a class-not-found error.

func ControlPanic added in v0.7.0

func ControlPanic(s *Scope, depth int, format string, args ...any)

ControlPanic raises a ControlError (control-error) describing a control error.

func Define

func Define(creator func(args List) Object, doc *FuncDoc, pkgs ...*Package)

Define a new golang function. If the package is provided the function is added to that package otherwise it is added to CurrentPackage (*package*).

func DescribeVar

func DescribeVar(sym Symbol) string

DescribeVar returns the documentation for the variable bound to the sym argument.

func DivisionByZeroPanic added in v1.0.0

func DivisionByZeroPanic(s *Scope, depth int, operation Object, operands List, format string, args ...any)

DivisionByZeroPanic raises a DivisionByZero (division-by-zero) describing a division by zero error.

func EndOfFilePanic added in v1.0.0

func EndOfFilePanic(s *Scope, depth int, stream Stream, format string, args ...any)

EndOfFilePanic raises a EndOfFile (end-of-file) describing a stream error.

func ErrorPanic added in v1.3.1

func ErrorPanic(s *Scope, depth int, format string, args ...any)

ErrorPanic raises an error.

func FilePanic added in v0.7.0

func FilePanic(s *Scope, depth int, pathname Object, format string, args ...any)

FilePanic raises a FilePanic (file-error) describing a file error.

func HasVar

func HasVar(sym Symbol) bool

HasVar returns true if the sym argument is bound to a value.

func InvalidMethodPanic added in v1.3.1

func InvalidMethodPanic(s *Scope, depth int, class, qualifier, name Object, format string, args ...any)

InvalidMethodPanic raises a invalid-method-error describing a invalid-method-error error.

func IsNil added in v1.3.1

func IsNil(v any) bool

IsNil checks for a nil value of an interface. Go values have two components not exposed, a type component and a value component. Further reading: https://research.swtch.com/interfaces. To ascertain whether the value is nil we ignore the type component and just check if the value component is set to 0.

func LessThan added in v1.0.0

func LessThan(v0, v1 Object) bool

LessThan returns true if v0 is less than v1.

func MethodArgChoicePanic added in v1.3.1

func MethodArgChoicePanic(s *Scope, depth int, inst Instance, method string, cnt int, choices string)

MethodArgChoicePanic raises a panic describing an invalid choice when the expected argument are a choice of a set of values.

func MethodArgCountCheck added in v1.3.1

func MethodArgCountCheck(s *Scope, depth int, inst Instance, method string, cnt, mn, mx int)

MethodArgCountCheck raises a panic describing the wrong number of arguments to a method if the argument count is outside the expected bounds.

func MethodArgCountPanic added in v1.3.1

func MethodArgCountPanic(s *Scope, depth int, inst Instance, method string, cnt, mn, mx int)

MethodArgCountPanic raises a panic describing the wrong number of arguments to a method.

func MustBeString added in v0.9.0

func MustBeString(arg Object, name string) (str string)

MustBeString returns a string if the arg is a symbol or string. If not a type error is raised with the name argument as the expected field in the error.

func NewMarker

func NewMarker(b byte) marker

NewMarker only exists for coverage testing.

func NoApplicableMethodPanic added in v1.3.1

func NoApplicableMethodPanic(s *Scope, depth int, gf Object, fargs List, format string, args ...any)

NoApplicableMethodPanic raises a no-applicable-method-error describing a no-applicable-method-error error.

func ObjectAppend

func ObjectAppend(b []byte, obj Object) []byte

ObjectAppend appends Object or "nil" if nil.

func ObjectEqual

func ObjectEqual(x, y Object) (eq bool)

ObjectEqual compares two Object for equality returning true if they are equal.

func ObjectString

func ObjectString(obj Object) string

ObjectString returns the string for an Object or "nil" if nil.

func PackagePanic added in v0.7.0

func PackagePanic(s *Scope, depth int, pkg *Package, format string, args ...any)

PackagePanic raises a PackageError (package-error) describing a package error.

func PanicSeriousCondition added in v1.3.1

func PanicSeriousCondition()

PanicSeriousCondition raises a serious-condition describing a serious condition.

func ParsePanic added in v0.7.0

func ParsePanic(s *Scope, depth int, format string, args ...any)

ParsePanic raises a ParseError (parse-error) describing a parse error.

func PrintNotReadablePanic added in v1.3.1

func PrintNotReadablePanic(s *Scope, depth int, object Object, format string, args ...any)

PrintNotReadablePanic raises a print-not-readable.

func ProgramPanic added in v0.7.0

func ProgramPanic(s *Scope, depth int, format string, args ...any)

ProgramPanic raises a ProgramError (program-error) describing a program error.

func ReadStreamEach added in v0.9.5

func ReadStreamEach(r io.Reader, s *Scope, caller Caller)

ReadStreamEach reads LISP source code from a stream and calls the callback for each s-expressions read.

func ReadStreamPush added in v0.9.5

func ReadStreamPush(r io.Reader, s *Scope, channel chan Object)

ReadStreamPush reads LISP source code from a stream and pushes s-expressions read onto a channel.

func ReaderPanic added in v0.7.0

func ReaderPanic(s *Scope, depth int, stream Stream, format string, args ...any)

ReaderPanic raises a ReaderError (reader-error) describing a parse error.

func RegisterClass added in v0.9.5

func RegisterClass(name string, c Class)

RegisterClass a class.

func RemoveClassHook added in v1.3.1

func RemoveClassHook(id string)

RemoveClassHook removes the class hook with the specified ID.

func RemoveDefunHook added in v0.9.5

func RemoveDefunHook(id string)

RemoveDefunHook removes the defun hook with the specified ID.

func RemovePackage added in v0.9.5

func RemovePackage(pkg *Package)

RemovePackage deletes a package.

func RemoveSetHook added in v0.9.5

func RemoveSetHook(id string)

RemoveSetHook removes the set hook with the specified ID.

func RemoveUnsetHook added in v0.9.5

func RemoveUnsetHook(id string)

RemoveUnsetHook removes the unset hook with the specified ID.

func RemoveVar

func RemoveVar(sym Symbol)

RemoveVar removes the binding to the sym argument.

func RuneFromReader added in v1.3.1

func RuneFromReader(reader io.Reader) (r rune, size int, err error)

RuneFromReader read a rune from an io.Reader.

func SetVar

func SetVar(sym Symbol, value Object)

SetVar binds the sym argument to a value.

func Simplify

func Simplify(obj Object) any

Simplify an Object.

func StreamPanic added in v0.7.0

func StreamPanic(s *Scope, depth int, stream Stream, format string, args ...any)

StreamPanic raises a StreamError (stream-error) describing a stream error.

func TypePanic added in v0.7.0

func TypePanic(s *Scope, depth int, use string, value Object, wants ...string)

TypePanic raises a TypeError (type-error) describing an incorrect type being used.

func UnboundSlotPanic added in v0.7.0

func UnboundSlotPanic(s *Scope, depth int, instance Object, name Object, format string, args ...any)

UnboundSlotPanic raises a UnboundSlot (unbound-slot) describing a unbound-slot error.

func UnboundVariablePanic added in v0.7.0

func UnboundVariablePanic(s *Scope, depth int, name Object, format string, args ...any)

UnboundVariablePanic raises a UnboundVariable (unbound-variable) describing a unbound-variable error.

func UndefinedFunctionPanic added in v0.7.0

func UndefinedFunctionPanic(s *Scope, depth int, name Object, format string, args ...any)

UndefinedFunctionPanic raises a UndefinedFunction (undefined-function) describing a undefined-function error.

func Untrace added in v0.9.5

func Untrace(args List)

Untrace turns tracing off for the scope and any future sub-scopes. If no arguments then tracing is turned off for all else just for the specified functions.

func Warn added in v0.7.0

func Warn(format string, args ...any)

Warn outputs a warning.

func Write

func Write(obj Object)

Write an Object to *standard-output*.

Types

type App added in v1.1.0

type App struct {
	// Title is the name of the application.
	Title string

	// Usage for help documentation.
	Usage func()

	// Plugins is a list of paths to the plugin packages to be included in the
	// go.mod file. (e.g., src/message.so)
	Plugins []string

	// Options identify the command line options for the application.
	Options []*AppArg

	// LispCode are the filepaths to the LISP source code. This use used
	// during development and to form an encrypted and embedded file when the
	// application is generated.
	LispCode []string

	// Source for the application. This is expected to be a single LISP file
	// that may be encryped with a key specified as a command line argument or
	// in a file.
	Source *embed.FS

	// KeyFlag is the command line flag for specifying a decryption key if the
	// source is encrypted.
	KeyFlag string

	// KeyFile is the path to the key file containing a decryption key if one
	// is needed.
	KeyFile string

	// EntryFunction is the name of a function or a lambda that takes no
	// arguments. This is called to run the application. It is started within
	// a scope that includes the command line argument variables already
	// bound.
	EntryFunction string

	// OnPanic is called if a panic is raised. It should return the exit code
	// for the application.
	OnPanic func(f any) int
}

App has multiple roles related to developing, generating, and running an application. During development of a standalone SLIP application the App can execute LISP code from source files. Once development is complete then App can be used to generate a standalone application project. When that application is run the App functions assist in setting up and evaluating the LISP code that implements the application behavior.

func (*App) BuildEmbed added in v1.1.0

func (app *App) BuildEmbed(dir string, key []byte)

BuildEmbed sources and plugin libraries to the specified directory. If a non empty key is provided then lisp sources are encrypted.

func (*App) Generate added in v1.1.0

func (app *App) Generate(dir string, key []byte, replace string, cleanup bool)

Generate project directory with a main.go, go.mod, and lisp code directory.

func (*App) Run added in v1.1.0

func (app *App) Run(args ...string) (exitCode int)

Run the application with the optional arguments. The args provide a means of testing during development.

type AppArg added in v1.1.0

type AppArg struct {
	// Flag is the command line flag such as 'v' which matches '-v' on the
	// command line.
	Flag string

	// Doc is the documentation or description of the flag as it appears in
	// the help display that is triggered a '-h' on the command line.
	Doc string

	// Default is the default SLIP object that will be assigned to the
	// variable associated with the flag unless over-ridden by a command line
	// option.
	Default Object

	// Type is the SLIP type to coerce the command line option value into.
	Type string

	// Var is the name of the variable to that is bound to the flag value.
	Var string
	// contains filtered or unexported fields
}

AppArg are used to specify then variables that will be set from the command line arguments.

func (*AppArg) DefaultReadable added in v1.1.0

func (aa *AppArg) DefaultReadable() (str string)

DefaultReadable returns the readable string that reads into the default value.

func (*AppArg) SetFlag added in v1.1.0

func (aa *AppArg) SetFlag(fs *flag.FlagSet, scope *Scope)

SetFlag sets the command line flag option for the argument.

func (*AppArg) UpdateScope added in v1.1.0

func (aa *AppArg) UpdateScope(scope *Scope)

UpdateScope updates the scope with the values in the app arg.

type Array

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

Array is an n dimensional collection of Objects.

func NewArray

func NewArray(
	dimensions []int,
	elementType Symbol,
	initElement Object,
	initContent List,
	adjustable bool) *Array

NewArray creates a new array with the specified dimensions and initial value.

func (*Array) Adjust added in v0.9.5

func (obj *Array) Adjust(dimensions []int, elementType Symbol, initElement Object, initContent List) *Array

Adjust array with new parameters.

func (*Array) Adjustable added in v0.9.5

func (obj *Array) Adjustable() bool

Adjustable returns true if the array is adjustable.

func (*Array) Append

func (obj *Array) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (*Array) ArrayType added in v1.0.0

func (obj *Array) ArrayType() Symbol

ArrayType returns 'array.

func (*Array) AsList

func (obj *Array) AsList() (list List)

AsList the Object into set of nested lists.

func (*Array) Dimensions

func (obj *Array) Dimensions() []int

Dimensions of the array.

func (*Array) ElementType added in v0.9.5

func (obj *Array) ElementType() Symbol

ElementType returns the element-type of the array.

func (*Array) Elements added in v0.9.5

func (obj *Array) Elements() []Object

Elements returns the elements of the array.

func (*Array) Equal

func (obj *Array) Equal(other Object) (eq bool)

Equal returns true if this Object and the other are equal in value.

func (*Array) Eval

func (obj *Array) Eval(s *Scope, depth int) Object

Eval returns self.

func (*Array) Get

func (obj *Array) Get(indexes ...int) Object

Get the value at the location identified by the indexes.

func (*Array) Hierarchy

func (obj *Array) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (*Array) Length added in v1.0.0

func (obj *Array) Length() int

Length returns the length of the object.

func (*Array) LoadForm added in v1.3.1

func (obj *Array) LoadForm() Object

LoadForm returns a form that can be evaluated to create the object.

func (*Array) MajorGet added in v0.9.5

func (obj *Array) MajorGet(index int) Object

MajorGet for the index provided.

func (*Array) MajorIndex added in v0.9.5

func (obj *Array) MajorIndex(indexes ...int) int

MajorIndex for the indexes provided.

func (*Array) MajorSet added in v0.9.5

func (obj *Array) MajorSet(index int, value Object)

MajorSet for the index provided.

func (*Array) Rank added in v0.9.5

func (obj *Array) Rank() int

Rank of the array is returned,

func (*Array) Set

func (obj *Array) Set(value Object, indexes ...int)

Set a value at the location identified by the indexes.

func (*Array) SetAll

func (obj *Array) SetAll(all List)

SetAll element from the nested list provided.

func (*Array) SetElementType added in v1.0.0

func (obj *Array) SetElementType(ts Object)

SetElementType returns the element-type of the array.

func (*Array) Simplify

func (obj *Array) Simplify() any

Simplify the Object into set of nested slices.

func (*Array) String

func (obj *Array) String() string

String representation of the Object.

type ArrayLike added in v1.0.0

type ArrayLike interface {
	Object

	// ArrayType returns the array type.
	ArrayType() Symbol

	// Dimensions of the array.
	Dimensions() []int

	// Length returns the length of the object.
	Length() int

	// AsList the Object into set of nested lists.
	AsList() List

	// Rank of the array is returned,
	Rank() int

	// Adjustable returns true if the array is adjustable.
	Adjustable() bool

	// ElementType returns the element-type of the array.
	ElementType() Symbol

	// SetElementType sets the element-type of the array.
	SetElementType(ts Object)

	// Get the value at the location identified by the indexes.
	Get(indexes ...int) Object

	// Set a value at the location identified by the indexes.
	Set(value Object, indexes ...int)

	// MajorIndex for the indexes provided.
	MajorIndex(indexes ...int) int

	// MajorGet for the index provided.
	MajorGet(index int) Object

	// MajorSet for the index provided.
	MajorSet(index int, value Object)
}

ArrayLike is an interface that all array and vectors implement.

type Bignum

type Bignum big.Int

Bignum is a numerator and denominator pair.

func NewBignum

func NewBignum(num int64) *Bignum

NewBignum creates a new Bignum.

func (*Bignum) Append

func (obj *Bignum) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (*Bignum) Equal

func (obj *Bignum) Equal(other Object) (eq bool)

Equal returns true if this Object and the other are equal in value.

func (*Bignum) Eval

func (obj *Bignum) Eval(s *Scope, depth int) Object

Eval returns self.

func (*Bignum) Hierarchy

func (obj *Bignum) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (*Bignum) Int64

func (obj *Bignum) Int64() int64

Int64 of the number.

func (*Bignum) IntegerType

func (obj *Bignum) IntegerType() Symbol

IntegerType returns 'fixnum.

func (*Bignum) IsInt64 added in v1.0.0

func (obj *Bignum) IsInt64() bool

IsInt64 returns true if the instance can be represented by an int64.

func (*Bignum) LoadForm added in v1.3.1

func (obj *Bignum) LoadForm() Object

LoadForm returns a form that can be evaluated to create the object.

func (*Bignum) NumberType

func (obj *Bignum) NumberType() Symbol

NumberType returns 'bignum.

func (*Bignum) RationalType

func (obj *Bignum) RationalType() Symbol

RationalType returns 'bignum.

func (*Bignum) Readably added in v1.3.1

func (obj *Bignum) Readably(b []byte, p *Printer) []byte

Readably appends the object to a byte slice. If p.Readbly is true the objects is appended in a readable format otherwise a simple append which may or may not be readable.

func (*Bignum) RealType

func (obj *Bignum) RealType() Symbol

RealType returns 'bignum.

func (*Bignum) RealValue

func (obj *Bignum) RealValue() float64

RealValue of the number as a float64.

func (*Bignum) Simplify

func (obj *Bignum) Simplify() any

Simplify the Object into an int64.

func (*Bignum) String

func (obj *Bignum) String() string

String representation of the Object.

type Bit added in v1.0.0

type Bit byte

Bit represents a one bit integer.

func (Bit) Append added in v1.0.0

func (obj Bit) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (Bit) Equal added in v1.0.0

func (obj Bit) Equal(other Object) (eq bool)

Equal returns true if this Object and the other are equal in value.

func (Bit) Eval added in v1.0.0

func (obj Bit) Eval(s *Scope, depth int) Object

Eval returns self.

func (Bit) Hierarchy added in v1.0.0

func (obj Bit) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (Bit) Int64 added in v1.0.0

func (obj Bit) Int64() (i int64)

Int64 of the number.

func (Bit) IntegerType added in v1.0.0

func (obj Bit) IntegerType() Symbol

IntegerType returns 'bit.

func (Bit) IsInt64 added in v1.0.0

func (obj Bit) IsInt64() bool

IsInt64 returns true if the instance can be represented by an int64.

func (Bit) LoadForm added in v1.3.1

func (obj Bit) LoadForm() Object

LoadForm returns a form that can be evaluated to create the object.

func (Bit) NumberType added in v1.0.0

func (obj Bit) NumberType() Symbol

NumberType returns 'bit.

func (Bit) RationalType added in v1.0.0

func (obj Bit) RationalType() Symbol

RationalType returns 'bit.

func (Bit) RealType added in v1.0.0

func (obj Bit) RealType() Symbol

RealType returns 'bit.

func (Bit) RealValue added in v1.0.0

func (obj Bit) RealValue() float64

RealValue of the number as a float64.

func (Bit) Simplify added in v1.0.0

func (obj Bit) Simplify() any

Simplify the Object into an int64.

func (Bit) String added in v1.0.0

func (obj Bit) String() string

String representation of the Object.

type BitVector added in v1.0.0

type BitVector struct {
	// Bytes in left to right order, the last byte includes padding on the low
	// bits if needed.
	Bytes     []byte
	Len       uint
	FillPtr   int
	CanAdjust bool
}

BitVector represents an integer with a specific number of bits.

func ReadBitVector added in v1.0.0

func ReadBitVector(b []byte) *BitVector

ReadBitVector parses a sequence of 0 and 1 to form a bit-vector.

func (*BitVector) Adjust added in v1.0.0

func (obj *BitVector) Adjust(dims []int, eType Symbol, initVal Object, initContent List, fillPtr int) VectorLike

Adjust array with new parameters.

func (*BitVector) Adjustable added in v1.0.0

func (obj *BitVector) Adjustable() bool

Adjustable returns true if the array is adjustable.

func (*BitVector) Append added in v1.0.0

func (obj *BitVector) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (*BitVector) ArrayType added in v1.0.0

func (obj *BitVector) ArrayType() Symbol

ArrayType returns 'bit-vector.

func (*BitVector) AsBignum added in v1.0.0

func (obj *BitVector) AsBignum() *Bignum

AsBignum returns the vector as a BigNum.

func (*BitVector) AsFixnum added in v1.0.0

func (obj *BitVector) AsFixnum() (Fixnum, bool)

AsFixnum returns a Fixnum with the same bits as the vector. If more than 64 bits are in the vector then the first 64 bits are used to form the Fixnum and the boolean return is false.

func (*BitVector) AsList added in v1.0.0

func (obj *BitVector) AsList() List

AsList the Object into set of nested lists.

func (*BitVector) At added in v1.0.0

func (obj *BitVector) At(pos uint) bool

At returns true if the bit at pos is set or false if not set.

func (*BitVector) Dimensions added in v1.0.0

func (obj *BitVector) Dimensions() []int

Dimensions of the array.

func (*BitVector) Duplicate added in v1.0.0

func (obj *BitVector) Duplicate() *BitVector

Duplicate the instance.

func (*BitVector) ElementType added in v1.0.0

func (obj *BitVector) ElementType() Symbol

ElementType returns the element-type of the array.

func (*BitVector) Equal added in v1.0.0

func (obj *BitVector) Equal(other Object) (eq bool)

Equal returns true if this Object and the other are equal in value.

func (*BitVector) Eval added in v1.0.0

func (obj *BitVector) Eval(s *Scope, depth int) Object

Eval returns self.

func (*BitVector) FillPointer added in v1.0.0

func (obj *BitVector) FillPointer() int

FillPointer returns the fill-pointer as an int.

func (*BitVector) Get added in v1.0.0

func (obj *BitVector) Get(indexes ...int) Object

Get the value at the location identified by the indexes.

func (*BitVector) Grow added in v1.0.0

func (obj *BitVector) Grow(cnt int)

Grow expands the bit-vector by the length specified.

func (*BitVector) Hierarchy added in v1.0.0

func (obj *BitVector) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (*BitVector) Length added in v1.0.0

func (obj *BitVector) Length() int

Length returns the length of the object.

func (*BitVector) LoadForm added in v1.3.1

func (obj *BitVector) LoadForm() Object

LoadForm returns a form that can be evaluated to create the object.

func (*BitVector) MajorGet added in v1.0.0

func (obj *BitVector) MajorGet(index int) Object

MajorGet for the index provided.

func (*BitVector) MajorIndex added in v1.0.0

func (obj *BitVector) MajorIndex(indexes ...int) int

MajorIndex for the indexes provided.

func (*BitVector) MajorSet added in v1.0.0

func (obj *BitVector) MajorSet(index int, value Object)

MajorSet for the index provided.

func (*BitVector) Pop added in v1.0.0

func (obj *BitVector) Pop() (element Object)

Pop a value from the vector. The vector elements are not changed if there is a fill-pointer. If there is no fill pointer then the length of the vector is shortened by one. Note a vector-pop without a fill pointer is not standard common lisp.

func (*BitVector) Push added in v1.0.0

func (obj *BitVector) Push(values ...Object) (index int)

Push a value onto the vector.

func (*BitVector) Put added in v1.0.0

func (obj *BitVector) Put(pos uint, value bool)

Put the bit at pos to the value.

func (*BitVector) Rank added in v1.0.0

func (obj *BitVector) Rank() int

Rank of the array is returned,

func (*BitVector) Reverse added in v1.0.0

func (obj *BitVector) Reverse()

Reverse the bits.

func (*BitVector) SequenceType added in v1.0.0

func (obj *BitVector) SequenceType() Symbol

SequenceType() Symbol returns 'bit-vector.

func (*BitVector) Set added in v1.0.0

func (obj *BitVector) Set(value Object, indexes ...int)

Set a value at the location identified by the indexes.

func (*BitVector) SetElementType added in v1.0.0

func (obj *BitVector) SetElementType(ts Object)

SetElementType sets the element-type of the bit-vector.

func (*BitVector) SetFillPointer added in v1.0.0

func (obj *BitVector) SetFillPointer(fp int)

SetFillPointer sets the fill-pointer.

func (*BitVector) Simplify added in v1.0.0

func (obj *BitVector) Simplify() any

Simplify the Object into an int64.

func (*BitVector) String added in v1.0.0

func (obj *BitVector) String() string

String representation of the Object.

type BoundCaller added in v0.7.0

type BoundCaller interface {
	// BoundCall applies a function to a set of already evaluated and bound
	// arguments.
	BoundCall(s *Scope, depth int) Object
}

BoundCaller is an interface shared functions that can be invoked with arguments already bound to the scope.

type Byte added in v1.0.0

type Byte = Octet

Byte is a unisgned 8 bit integer..

type Caller

type Caller interface {
	// Call applies a function to a set of already evaluated arguments.
	Call(s *Scope, args List, depth int) Object
}

Caller is an interface shared by all functions.

type Character

type Character rune

Character is a character Object.

func ReadCharacter

func ReadCharacter(src []byte) (c Character)

ReadCharacter read a character from bytes that would follow #\.

func (Character) Append

func (obj Character) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (Character) Equal

func (obj Character) Equal(other Object) bool

Equal returns true if this Object and the other are equal in value.

func (Character) Eval

func (obj Character) Eval(s *Scope, depth int) Object

Eval returns self.

func (Character) Hierarchy

func (obj Character) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as characters for the instance.

func (Character) LoadForm added in v1.3.1

func (obj Character) LoadForm() Object

LoadForm returns a form that can be evaluated to create the object.

func (Character) Readably added in v1.3.1

func (obj Character) Readably(b []byte, p *Printer) []byte

Readably appends the object to a byte slice. If p.Readbly is true the objects is appended in a readable format otherwise a simple append which may or may not be readable.

func (Character) Simplify

func (obj Character) Simplify() any

Simplify the Object into a string.

func (Character) String

func (obj Character) String() string

String representation of the Object.

type Class added in v0.7.0

type Class interface {
	Object

	// Name of the class.
	Name() string

	// Package the class is defined in.
	Pkg() *Package

	// Documentation of the class.
	Documentation() string

	// SetDocumentation of the class.
	SetDocumentation(doc string)

	// Describe the class in detail.
	Describe(b []byte, indent, right int, ansi bool) []byte

	// MakeInstance creates a new instance but does not call the :init method.
	MakeInstance() Instance

	// Inherits returns true if this Class inherits from a specified Class.
	Inherits(c Class) bool

	// InheritsList returns a list of all inherited classes.
	InheritsList() []Class

	// LoadForm should return a list that can be evaluated to create the class
	// or nil if the class is a built in class. As an example, a flavor would
	// be created by a defflavor expression.
	LoadForm() Object

	// Metaclass returns the name of the class's meta class which can be
	// built-in-class, standard-class, flavor, or condition-class.
	Metaclass() Symbol

	// VarNames for DefMethod, requiredVars and defaultVars combined.
	VarNames() []string
}

Class represents all class types.

func FindClass added in v0.9.5

func FindClass(name string) (c Class)

Find finds the named class.

type Code

type Code []Object

Code is a list of S-Expressions read from LISP source code. It is a means of keeping loaded code together so that it can be evaluated and optimized for subsequent evaluations.

func Read

func Read(src []byte, s *Scope) (code Code)

Read LISP source code and return a Code instance.

func ReadOne added in v0.7.0

func ReadOne(src []byte, s *Scope) (code Code, pos int)

ReadOne LISP source code and return a Code instance.

func ReadStream added in v0.9.5

func ReadStream(r io.Reader, s *Scope, one ...bool) (Code, int)

ReadStream reads LISP source code from a stream and return a Code instance.

func ReadString

func ReadString(src string, s *Scope) (code Code)

ReadString reads LISP source code and return a Code instance.

func (Code) Compile

func (c Code) Compile()

Compile all the code elements. This evaluates all the defun, defvar, and defmacro calls and converts unquoted lists to functions.

func (Code) Eval

func (c Code) Eval(scope *Scope, w io.Writer) (result Object)

Eval all code elements and return the value of the last evaluation.

func (Code) String

func (c Code) String() string

String returns a string representation of the instance.

type Combination added in v1.3.1

type Combination struct {
	From    Class
	Primary Caller
	Before  Caller
	After   Caller
	Wrap    Caller
}

Combination is the combined method functions for a class.

func (*Combination) Empty added in v1.3.1

func (c *Combination) Empty() bool

Empty return true if there are no daemons in the combination.

func (*Combination) Simplify added in v1.3.1

func (c *Combination) Simplify() any

Simplify by returning a representation of the combination.

type Complex

type Complex complex128

Complex is a numerator and denominator pair.

func (Complex) Append

func (obj Complex) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (Complex) Equal

func (obj Complex) Equal(other Object) (eq bool)

Equal returns true if this Object and the other are equal in value.

func (Complex) Eval

func (obj Complex) Eval(s *Scope, depth int) Object

Eval returns self.

func (Complex) Hierarchy

func (obj Complex) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (Complex) LoadForm added in v1.3.1

func (obj Complex) LoadForm() Object

LoadForm returns a form that can be evaluated to create the object.

func (Complex) NumberType

func (obj Complex) NumberType() Symbol

NumberType returns 'complex.

func (Complex) Simplify

func (obj Complex) Simplify() any

Simplify the Object into an int64.

func (Complex) String

func (obj Complex) String() string

String representation of the Object.

type Describer

type Describer interface {
	// Describe the instance in detail.
	Describe(b []byte, indent, right int, ansi bool) []byte
}

Describer is the interface for types that respond to Describe() for use in the cl::describe function.

type DocArg

type DocArg struct {
	Name    string
	Type    string
	Text    string
	Default Object
}

DocArg describes a function argument.

type DoubleFloat

type DoubleFloat float64

DoubleFloat is a float64 Object.

func (DoubleFloat) Append

func (obj DoubleFloat) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (DoubleFloat) Equal

func (obj DoubleFloat) Equal(other Object) (eq bool)

Equal returns true if this Object and the other are equal in value.

func (DoubleFloat) Eval

func (obj DoubleFloat) Eval(s *Scope, depth int) Object

Eval returns self.

func (DoubleFloat) FloatType

func (obj DoubleFloat) FloatType() Symbol

FloatType returns 'double-float.

func (DoubleFloat) Hierarchy

func (obj DoubleFloat) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (DoubleFloat) LoadForm added in v1.3.1

func (obj DoubleFloat) LoadForm() Object

LoadForm returns a form that can be evaluated to create the object.

func (DoubleFloat) NumberType

func (obj DoubleFloat) NumberType() Symbol

NumberType returns 'double-float.

func (DoubleFloat) Readably added in v1.3.1

func (obj DoubleFloat) Readably(b []byte, p *Printer) []byte

Readably appends the object to a byte slice. If p.Readbly is true the objects is appended in a readable format otherwise a simple append which may or may not be readable.

func (DoubleFloat) RealType

func (obj DoubleFloat) RealType() Symbol

RealType returns 'double-float.

func (DoubleFloat) RealValue

func (obj DoubleFloat) RealValue() float64

RealValue of the number as a float64.

func (DoubleFloat) Simplify

func (obj DoubleFloat) Simplify() any

Simplify the Object into a float64.

func (DoubleFloat) String

func (obj DoubleFloat) String() string

String representation of the Object.

type Dynamic

type Dynamic struct {
	Function
}

Dynamic represents a function defined by a call to defun or lambda.

func (*Dynamic) Append

func (f *Dynamic) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (*Dynamic) LoadForm added in v1.3.1

func (obj *Dynamic) LoadForm() Object

LoadForm returns a form that can be evaluated to create the object.

func (*Dynamic) Simplify

func (f *Dynamic) Simplify() any

Simplify the function.

func (*Dynamic) String

func (f *Dynamic) String() string

String representation of the Object.

type FileStream

type FileStream os.File

FileStream is a *os.File.

func (*FileStream) Append

func (obj *FileStream) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (*FileStream) Close

func (obj *FileStream) Close() error

Close made visible since os.File functions are not automatically visible.

func (*FileStream) Equal

func (obj *FileStream) Equal(other Object) bool

Equal returns true if this Object and the other are equal in value.

func (*FileStream) Eval

func (obj *FileStream) Eval(s *Scope, depth int) Object

Eval returns self.

func (*FileStream) FileLength added in v1.0.0

func (obj *FileStream) FileLength() (length Object)

FileLength return the length of a file.

func (*FileStream) Hierarchy

func (obj *FileStream) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (*FileStream) IsOpen added in v1.0.0

func (obj *FileStream) IsOpen() bool

IsOpen return true if the stream is open or false if not.

func (*FileStream) LastByte added in v1.0.0

func (obj *FileStream) LastByte() byte

LastByte returns the last byte written or zero if nothing has been written.

func (*FileStream) Read

func (obj *FileStream) Read(b []byte) (int, error)

Read made visible since os.File functions are not automatically visible.

func (*FileStream) ReadByte added in v1.3.1

func (obj *FileStream) ReadByte() (b byte, err error)

ReadByte reads a byte.

func (*FileStream) ReadRune added in v1.3.1

func (obj *FileStream) ReadRune() (r rune, size int, err error)

ReadRune returns the next rune in buf from the current position. This is part of the io.RuneReader interface.

func (*FileStream) Seek added in v1.0.0

func (obj *FileStream) Seek(offset int64, whence int) (n int64, err error)

Seek moves the pos in buf. This is part of the io.Seeker interface.

func (*FileStream) Simplify

func (obj *FileStream) Simplify() any

Simplify the Object into an int64.

func (*FileStream) StreamType

func (obj *FileStream) StreamType() Symbol

StreamType returns 'fileStream.

func (*FileStream) String

func (obj *FileStream) String() string

String representation of the Object.

func (*FileStream) UnreadRune added in v1.3.1

func (obj *FileStream) UnreadRune() error

UnreadRune calls UnreadRune on the input if not closed.

func (*FileStream) Write

func (obj *FileStream) Write(b []byte) (int, error)

Write made visible since os.File functions are not automatically visible.

type FillPtrVector added in v1.0.0

type FillPtrVector interface {
	VectorLike

	// FillPointer returns the fill-pointer as an int. A value less than zero
	// indicates no fill-pointer is set.
	FillPointer() int

	// SetFillPointer sets the fill-pointer.
	SetFillPointer(int)

	// Pop a value from the vector. The vector elements are not changed if
	// there is a fill-pointer. If there is no fill pointer then the length of
	// the vector is shortened by one.
	Pop() (element Object)

	// Push a value onto the vector.
	Push(values ...Object) (index int)
}

FillPtrVector is a vector with a possible fillpointer

type Fixnum

type Fixnum int64

Fixnum is a int64 Object.

func (Fixnum) Append

func (obj Fixnum) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (Fixnum) Equal

func (obj Fixnum) Equal(other Object) (eq bool)

Equal returns true if this Object and the other are equal in value.

func (Fixnum) Eval

func (obj Fixnum) Eval(s *Scope, depth int) Object

Eval returns self.

func (Fixnum) Hierarchy

func (obj Fixnum) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (Fixnum) Int64

func (obj Fixnum) Int64() int64

Int64 of the number.

func (Fixnum) IntegerType

func (obj Fixnum) IntegerType() Symbol

IntegerType returns 'fixnum.

func (Fixnum) IsInt64 added in v1.0.0

func (obj Fixnum) IsInt64() bool

IsInt64 returns true if the instance can be represented by an int64.

func (Fixnum) LoadForm added in v1.3.1

func (obj Fixnum) LoadForm() Object

LoadForm returns a form that can be evaluated to create the object.

func (Fixnum) NumberType

func (obj Fixnum) NumberType() Symbol

NumberType returns 'fixnum.

func (Fixnum) RationalType

func (obj Fixnum) RationalType() Symbol

RationalType returns 'fixnum.

func (Fixnum) Readably added in v1.3.1

func (obj Fixnum) Readably(b []byte, p *Printer) []byte

Readably appends the object to a byte slice. If p.Readbly is true the objects is appended in a readable format otherwise a simple append which may or may not be readable.

func (Fixnum) RealType

func (obj Fixnum) RealType() Symbol

RealType returns 'fixnum.

func (Fixnum) RealValue

func (obj Fixnum) RealValue() float64

RealValue of the number as a float64.

func (Fixnum) Simplify

func (obj Fixnum) Simplify() any

Simplify the Object into an int64.

func (Fixnum) String

func (obj Fixnum) String() string

String representation of the Object.

type Float

type Float interface {
	Real

	// FloatType returns the float type of the instance which can be one of: fixnum or bignum.
	FloatType() Symbol
}

Float exists to allow assertions to determine if an Object is an float.

type FuncDoc

type FuncDoc struct {
	Name     string
	Args     []*DocArg
	Return   string // return type
	Text     string
	Examples []string
	Kind     Symbol
	NoExport bool
}

FuncDoc describes a function.

func DescribeFunction

func DescribeFunction(sym Symbol, pkg ...*Package) *FuncDoc

DescribeFunction returns the documentation for the function bound to the sym argument.

func (*FuncDoc) Describe added in v1.3.1

func (fd *FuncDoc) Describe(b []byte, indent, right int, ansi bool) []byte

Describe the instance in detail.

func (*FuncDoc) LoadForm added in v1.3.1

func (fd *FuncDoc) LoadForm() Object

LoadForm return a argument list for function or lambda args list.

type FuncInfo

type FuncInfo struct {
	Name   string
	Create func(args List) Object
	Doc    *FuncDoc
	Pkg    *Package // package interned in
	Kind   Symbol
	Aux    any
	Export bool
}

FuncInfo stores information about a function.

func FindFunc

func FindFunc(name string, pkgs ...*Package) (fi *FuncInfo)

FindFunc finds the FuncInfo for a provided name or return nil if none exists.

func MustFindFunc added in v0.9.5

func MustFindFunc(name string, pkgs ...*Package) *FuncInfo

MustFindFunc finds the FuncInfo for a provided name or panics if none exists.

func (*FuncInfo) Append

func (obj *FuncInfo) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (*FuncInfo) Apply

func (obj *FuncInfo) Apply(s *Scope, args List, depth int) (result Object)

Apply evaluates with the need to evaluate the args.

func (*FuncInfo) Describe

func (obj *FuncInfo) Describe(b []byte, indent, right int, ansi bool) []byte

Describe the instance in detail.

func (*FuncInfo) Equal

func (obj *FuncInfo) Equal(other Object) (eq bool)

Equal returns true if this Object and the other are equal in value.

func (*FuncInfo) Eval

func (obj *FuncInfo) Eval(s *Scope, depth int) Object

Eval returns self.

func (*FuncInfo) FuncDocs added in v1.3.1

func (obj *FuncInfo) FuncDocs() *FuncDoc

FuncDocs returns the documentation for the object.

func (*FuncInfo) Hierarchy

func (obj *FuncInfo) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (*FuncInfo) LoadForm added in v1.3.1

func (obj *FuncInfo) LoadForm() Object

LoadForm returns a list that when evaluated defines then function described by this FuncInfo.

func (*FuncInfo) Simplify

func (obj *FuncInfo) Simplify() any

Simplify the Object into an int64.

func (*FuncInfo) String

func (obj *FuncInfo) String() string

String representation of the Object.

type Function

type Function struct {

	// Name of the function.
	Name string

	// Args are the un-evaluated and un-compiled arguments.
	Args List

	// Self points to the encapsulating object.
	Self Caller

	// SkipEval is a slice of flags indicating which arguments should be
	// evaluated before calling Self.Call(). The last bool is the value used
	// for &rest arguments if present.
	SkipEval []bool

	Pkg *Package
}

Function is the base type for most if not all functions.

func (*Function) Append

func (f *Function) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (*Function) Apply

func (f *Function) Apply(s *Scope, args List, depth int) (result Object)

Apply evaluates with the need to evaluate the args.

func (*Function) Caller

func (f *Function) Caller() Caller

Caller returns the function's Caller (Self).

func (*Function) CompileArgs

func (f *Function) CompileArgs()

CompileArgs for the function.

func (*Function) Equal

func (f *Function) Equal(other Object) bool

Equal returns true if this Object and the other are equal in value.

func (*Function) Eval

func (f *Function) Eval(s *Scope, depth int) (result Object)

Eval the object.

func (*Function) GetArgs

func (f *Function) GetArgs() List

GetArgs returns the function arguments.

func (*Function) GetName

func (f *Function) GetName() string

GetName returns the function name.

func (*Function) GetPkg added in v0.9.5

func (f *Function) GetPkg() *Package

GetPkg returns the package the function was defined in.

func (*Function) Hierarchy

func (f *Function) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (*Function) LoadForm added in v1.3.1

func (f *Function) LoadForm() Object

LoadForm returns a form that can be evaluated to create the object.

func (*Function) Simplify

func (f *Function) Simplify() any

Simplify the function.

func (*Function) SkipArgEval added in v0.9.5

func (f *Function) SkipArgEval(i int) (skip bool)

SkipArgEval returns true if the argument eval should be skipped.

func (*Function) String

func (f *Function) String() string

String representation of the Object.

type Funky

type Funky interface {
	Object

	// GetArgs returns the function arguments.
	GetArgs() List

	// GetName returns the function name.
	GetName() string

	// Apply evaluates without the need to evaluate the args..
	Apply(s *Scope, args List, depth int) Object

	// CompileArgs for the function.
	CompileArgs()

	// Caller returns the function's Caller (Self).
	Caller() Caller

	// GetPkg returns the package the function was defined in.
	GetPkg() *Package
	// contains filtered or unexported methods
}

Funky is an interface shared by all functions.

func NewFunc

func NewFunc(name string, args List, pkgs ...*Package) Funky

NewFunc creates a new instance of the named function with the arguments provided.

type HasFuncDocs added in v1.3.1

type HasFuncDocs interface {
	// FuncDocs returns the documentation for the object.
	FuncDocs() *FuncDoc
}

HasFuncDocs is an interface for objects that have FuncDoc documentation.

type HashTable

type HashTable map[Object]Object

HashTable of Objects.

func (HashTable) Append

func (obj HashTable) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (HashTable) Equal

func (obj HashTable) Equal(other Object) (eq bool)

Equal returns true if this Object and the other are equal in value.

func (HashTable) Eval

func (obj HashTable) Eval(s *Scope, depth int) Object

Eval returns self.

func (HashTable) Hierarchy

func (obj HashTable) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (HashTable) Length

func (obj HashTable) Length() int

Length returns the length of the object.

func (HashTable) LoadForm added in v1.3.1

func (obj HashTable) LoadForm() Object

LoadForm returns a form that can be evaluated to create the object.

func (HashTable) Simplify

func (obj HashTable) Simplify() any

Simplify the Object into a []any.

func (HashTable) String

func (obj HashTable) String() string

String representation of the Object.

type IOStream added in v0.9.5

type IOStream struct {
	RW io.ReadWriter
}

IOStream is a io.ReadWriter.

func (*IOStream) Append added in v0.9.5

func (obj *IOStream) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (*IOStream) Close added in v0.9.5

func (obj *IOStream) Close() (err error)

Close made visible since os.File functions are not automatically visible.

func (*IOStream) Equal added in v0.9.5

func (obj *IOStream) Equal(other Object) bool

Equal returns true if this Object and the other are equal in value.

func (*IOStream) Eval added in v0.9.5

func (obj *IOStream) Eval(s *Scope, depth int) Object

Eval returns self.

func (*IOStream) Hierarchy added in v0.9.5

func (obj *IOStream) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (*IOStream) IsOpen added in v1.0.0

func (obj *IOStream) IsOpen() bool

IsOpen return true if the stream is open or false if not.

func (*IOStream) LastByte added in v1.0.0

func (obj *IOStream) LastByte() byte

LastByte returns the last byte written or zero if nothing has been written.

func (*IOStream) Read added in v0.9.5

func (obj *IOStream) Read(b []byte) (cnt int, err error)

Read made visible since io.Read functions are not automatically visible.

func (*IOStream) Simplify added in v0.9.5

func (obj *IOStream) Simplify() any

Simplify the Object into an int64.

func (*IOStream) StreamType added in v0.9.5

func (obj *IOStream) StreamType() Symbol

StreamType returns 'ioStream.

func (*IOStream) String added in v0.9.5

func (obj *IOStream) String() string

String representation of the Object.

func (*IOStream) Write added in v0.9.5

func (obj *IOStream) Write(b []byte) (int, error)

Write made visible since io.Write functions are not automatically visible.

type Import

type Import struct {
	Pkg  *Package
	Name string
}

Import is used to identify what package variables are imported.

func (*Import) Simplify

func (imp *Import) Simplify() any

Simplify the Object into an int64.

type InputStream

type InputStream struct {
	RuneReader
}

InputStream wraps a io.Reader.

func NewInputStream added in v1.3.1

func NewInputStream(r io.Reader) *InputStream

NewInputStream create and return a new InputStream for the provided io.Reader.

func (*InputStream) Append

func (obj *InputStream) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (*InputStream) Equal

func (obj *InputStream) Equal(other Object) bool

Equal returns true if this Object and the other are equal in value.

func (*InputStream) Eval

func (obj *InputStream) Eval(s *Scope, depth int) Object

Eval returns self.

func (*InputStream) Hierarchy

func (obj *InputStream) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (*InputStream) Simplify

func (obj *InputStream) Simplify() any

Simplify the Object into an int64.

func (*InputStream) StreamType

func (obj *InputStream) StreamType() Symbol

StreamType returns 'inputStream.

func (*InputStream) String

func (obj *InputStream) String() string

String representation of the Object.

type Instance added in v0.7.0

type Instance interface {
	Object
	Receiver

	// Class of the instance.
	Class() Class

	// IsA returns true if the instance's class is the specified class or a
	// sub-class of the specified class.
	IsA(class string) bool

	// Init the instance slots from the provided args list. If the scope is
	// not nil then send :init is called.
	Init(scope *Scope, args List, depth int)

	// SetSynchronized sets the instance to be thread safe (mutex protected
	// slots) or not.
	SetSynchronized(on bool)

	// Synchronized returns true if the instance is thread safe.
	Synchronized() bool

	// SlotNames returns a list of the slots names for the instance.
	SlotNames() []string

	// SlotValue return the value of an instance variable.
	SlotValue(name Symbol) (Object, bool)

	// SetSlotValue sets the value of an instance variable and return true if
	// the name slot exists and was set.
	SetSlotValue(sym Symbol, value Object) (has bool)

	// GetMethod returns the method if it exists.
	GetMethod(name string) *Method

	// MethodNames returns a sorted list of the methods of the class.
	MethodNames() List

	// ID returns unique ID for the instance.
	ID() uint64

	// Dup returns a duplicate of the instance.
	Dup() Instance
}

type Integer

type Integer interface {
	Rational

	// IntegerType returns the integer type of the instance which can be one
	// of: fixnum or bignum.
	IntegerType() Symbol

	// IsInt64 returns true if the instance can be represented by an int64.
	IsInt64() bool

	// Int64 returns the closest int64 of the integer.
	Int64() int64
}

Integer exists to allow assertions to determine if an Object is an integer.

type Lambda

type Lambda struct {
	Doc     *FuncDoc
	Forms   List
	Closure *Scope
	Macro   bool
}

Lambda is a Caller for forms/objects. It provides a level of indirection so that functions can be defined without regard to the order defined.

func DefLambda

func DefLambda(defName string, s *Scope, args List, extraVars ...string) (lam *Lambda)

DefLambda parses arguments into a Lambda. Arguments should be a lambda-list followed by an optional documentation strings and then the forms to evaluate when the Lambda is called. The extraVars is a list of variables that will be defined when the lambda is called. This is used for methods where the scope will be an instance of a flavor/class.

func (*Lambda) Append

func (lam *Lambda) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (*Lambda) BoundCall added in v0.7.0

func (lam *Lambda) BoundCall(s *Scope, depth int) (result Object)

BoundCall the the function with the bindings provided.

func (*Lambda) Call

func (lam *Lambda) Call(s *Scope, args List, depth int) (result Object)

Call the the function with the arguments provided.

func (*Lambda) Compile added in v1.3.1

func (lam *Lambda) Compile(s *Scope, extraVars ...string)

Compile forms while in the current package instead of waiting until invoked.

func (*Lambda) Docs added in v1.1.0

func (lam *Lambda) Docs() (docs string)

Docs returns the documentation of the instance.

func (*Lambda) Equal

func (lam *Lambda) Equal(other Object) bool

Equal returns true if this Object and the other are equal in value.

func (*Lambda) Eval

func (lam *Lambda) Eval(s *Scope, depth int) (result Object)

Eval the object.

func (*Lambda) Hierarchy

func (lam *Lambda) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (*Lambda) LoadForm added in v1.3.1

func (lam *Lambda) LoadForm() Object

LoadForm returns a definition list such as (lambda (x) (1+ x)).

func (*Lambda) Simplify

func (lam *Lambda) Simplify() any

Simplify the function.

func (*Lambda) String

func (lam *Lambda) String() string

String representation of the Object.

type LastBytePeeker added in v1.0.0

type LastBytePeeker interface {

	// LastByte returns the last byte written or zero if nothing has been written.
	LastByte() byte
}

LastBytePeeker is an interface for checking the last byte written.

type List

type List []Object

List of Objects.

func InstanceLoadForm added in v1.3.1

func InstanceLoadForm(obj Instance) (form List)

InstanceLoadForm created a load form for an instance.

func PackageNames

func PackageNames() (names List)

PackageNames returns a sorted list of package names.

func Trace

func Trace(args List) (names List)

Trace turns tracing on or off for the scope and any future sub-scopes.

func (List) Append

func (obj List) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (List) Car

func (obj List) Car() (car Object)

Car of the list

func (List) Cdr

func (obj List) Cdr() (cdr Object)

Cdr of the list.

func (List) Equal

func (obj List) Equal(other Object) (eq bool)

Equal returns true if this Object and the other are equal in value.

func (List) Eval

func (obj List) Eval(s *Scope, depth int) Object

Eval panics unless the list is empty.

func (List) Hierarchy

func (obj List) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (List) Length

func (obj List) Length() int

Length returns the length of the object.

func (List) LoadForm added in v1.3.1

func (obj List) LoadForm() Object

LoadForm returns a form that can be evaluated to create the object or panics if that is not possible.

func (List) SequenceType

func (obj List) SequenceType() Symbol

SequenceType returns 'list or 'cons if a cons.

func (List) Simplify

func (obj List) Simplify() any

Simplify the Object into a []any.

func (List) String

func (obj List) String() string

String representation of the Object.

type LoadFormer added in v1.3.1

type LoadFormer interface {

	// LoadForm should return a form that can be evaluated to create the object
	// or panic if that is not possible.
	LoadForm() Object
}

LoadFormer is an interface for objects that implement the LoadForm() function.

type Locker added in v1.3.1

type Locker interface {
	Lock()
	Unlock()
	TryLock() bool
}

Locker interface is used to act as an interface for either a sync.Mutex or a non-operational stand in for a mutex. Note that changing from one to the other should only be done while there is only one thread using the Locker.

type LongFloat

type LongFloat big.Float

LongFloat is a big.float Object.

func NewLongFloat

func NewLongFloat(num float64) *LongFloat

NewLongFloat creates a new Float.

func (*LongFloat) Append

func (obj *LongFloat) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (*LongFloat) Equal

func (obj *LongFloat) Equal(other Object) (eq bool)

Equal returns true if this Object and the other are equal in value.

func (*LongFloat) Eval

func (obj *LongFloat) Eval(s *Scope, depth int) Object

Eval returns self.

func (*LongFloat) FloatType

func (obj *LongFloat) FloatType() Symbol

FloatType returns 'long-float.

func (*LongFloat) Hierarchy

func (obj *LongFloat) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (*LongFloat) LoadForm added in v1.3.1

func (obj *LongFloat) LoadForm() Object

LoadForm returns a form that can be evaluated to create the object.

func (*LongFloat) NumberType

func (obj *LongFloat) NumberType() Symbol

NumberType returns 'long-float.

func (*LongFloat) Readably added in v1.3.1

func (obj *LongFloat) Readably(b []byte, p *Printer) []byte

Readably appends the object to a byte slice. If p.Readbly is true the objects is appended in a readable format otherwise a simple append which may or may not be readable.

func (*LongFloat) RealType

func (obj *LongFloat) RealType() Symbol

RealType returns 'long-float.

func (*LongFloat) RealValue

func (obj *LongFloat) RealValue() float64

RealValue of the number as a float64.

func (*LongFloat) Simplify

func (obj *LongFloat) Simplify() any

Simplify the Object into a float64.

func (*LongFloat) String

func (obj *LongFloat) String() string

String representation of the Object.

type Method added in v1.3.1

type Method struct {
	Name         string
	Doc          *FuncDoc
	Combinations []*Combination
}

Method represents a method for flavors and CLOS generics.

func (*Method) Append added in v1.3.1

func (m *Method) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (*Method) BoundCall added in v1.3.1

func (m *Method) BoundCall(s *Scope, depth int) Object

func (*Method) BoundInnerCall added in v1.3.1

func (m *Method) BoundInnerCall(s *Scope, depth int) (result Object)

func (*Method) Call added in v1.3.1

func (m *Method) Call(s *Scope, args List, depth int) Object

Call the method.

func (*Method) CompareArgs added in v1.3.1

func (m *Method) CompareArgs(fd *FuncDoc)

CompareArgs compares argument types and panics on a mismatch.

func (*Method) Equal added in v1.3.1

func (m *Method) Equal(other Object) (eq bool)

Equal returns true if this Object and the other are equal in value.

func (*Method) Eval added in v1.3.1

func (m *Method) Eval(s *Scope, depth int) Object

Eval returns self.

func (*Method) HasMethodFromClass added in v1.3.1

func (m *Method) HasMethodFromClass(from string) bool

HasMethodFromClass return true if a combinations from a class is present.

func (*Method) Hierarchy added in v1.3.1

func (m *Method) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the whopLoc.

func (*Method) InnerCall added in v1.3.1

func (m *Method) InnerCall(s *Scope, args List, depth int) (result Object)

InnerCall calls the before, after, and primary method daemons.

func (*Method) Simplify added in v1.3.1

func (m *Method) Simplify() any

Simplify by returning a representation of the method.

func (*Method) String added in v1.3.1

func (m *Method) String() string

String representation of the Object.

type NoOpLocker added in v1.3.1

type NoOpLocker struct{}

NoOpLocker is a Locker that does nothing acting instead like a Mutex that does nothing.

func (NoOpLocker) Lock added in v1.3.1

func (NoOpLocker) Lock()

Lock does nothing.

func (NoOpLocker) TryLock added in v1.3.1

func (NoOpLocker) TryLock() bool

TryLock does nothing.

func (NoOpLocker) Unlock added in v1.3.1

func (NoOpLocker) Unlock()

Unlock does nothing.

type Number

type Number interface {
	Object

	// NumberType returns the number type of the instance which can be one of:
	// fixnum, bignum, float, ratio, or complex.
	NumberType() Symbol
}

Number exists to allow assertions to determine if an Object is an number.

type Object

type Object interface {
	fmt.Stringer

	// Append the object to a byte slice.
	Append(b []byte) []byte

	// Simplify the Object into simple go types of nil, bool, int64, float64,
	// string, []any, map[string]any, or time.Time.
	Simplify() any

	// Equal returns true if this Object and the other are equal in value.
	Equal(other Object) bool

	// Hierarchy returns the class hierarchy as symbols for the instance.
	Hierarchy() []Symbol

	// Eval the object.
	Eval(s *Scope, depth int) Object
}

Object is the interface for all LISP entities other than nil.

func ArithmeticErrorNew added in v1.3.1

func ArithmeticErrorNew(s *Scope, depth int, operation Object, operands List, format string, args ...any) Object

ArithmeticErrorNew creates a ArithmeticError (arithmetic-error) describing a arithmetic error.

func CellErrorNew added in v1.3.1

func CellErrorNew(s *Scope, depth int, name Object, format string, args ...any) Object

CellErrorNew raises a CellError (cell-error) describing a cell error.

func ClassNotFoundNew added in v1.3.1

func ClassNotFoundNew(s *Scope, depth int, name Object, format string, args ...any) Object

ClassNotFoundNew creates a new ClassNotFound (class-not-found) describing a class-not-found error.

func Coerce added in v1.0.0

func Coerce(object, typeSpec Object) (result Object)

Coerce_ returns object converted to type. A type of t always returns object. Although not Common LISP standard other conversion are supported when possible as indicated in the table where the vertical axis is the source object type and the horizontal axis the target type:

|list
| |string
| | |vector
| | | |octets (bytes)
| | | | |bit-vector
| | | | | |character
| | | | | | |integer
| | | | | | | |fixnum
| | | | | | | | |octet (byte)
| | | | | | | | | |bignum
| | | | | | | | | | |float
| | | | | | | | | | | |short-float
| | | | | | | | | | | | |single-float
| | | | | | | | | | | | | |double-float
| | | | | | | | | | | | | | |long-float
| | | | | | | | | | | | | | | |rational
| | | | | | | | | | | | | | | | |ratio
| | | | | | | | | | | | | | | | | |complex
| | | | | | | | | | | | | | | | | | |symbol
| | | | | | | | | | | | | | | | | | | |assoc
| | | | | | | | | | | | | | | | | | | | |hash-table
| | | | | | | | | | | | | | | | | | | | | |function
| | | | | | | | | | | | | | | | | | | | | | |signed-byte
| | | | | | | | | | | | | | | | | | | | | | | |unsigned-byte

list |x|x|x|x|x| | | | | | | | | | | | | | | | | | | | string |x|x|x|x| | | | | | | | | | | | | | |x| | |x| | | vector |x|x|x|x|x| | | | | | | | | | | | | | | | | | | | octets |x|x|x|x|x| | | | | | | | | | | | | | | | | | | | bit-vector |x| |x|x|x| |x|x|x|x| | | | | | | | | | | | |x|x| character | | | | | |x|x|x|x|x|x|x|x|x|x|x|x|x| | | | |x|x| integer | | | | |x|x|x|x|x|x|x|x|x|x|x|x|x|x| | | | |x|x| fixnum | | | | |x|x|x|x|x|x|x|x|x|x|x|x|x|x| | | | |x|x| octet | | | | |x|x|x|x|x|x|x|x|x|x|x|x|x|x| | | | |x|x| float | | | | | |x|x|x|x|x|x|x|x|x|x|x|x|x| | | | | | | ratio | | | | | |x|x|x|x|x|x|x|x|x|x|x|x|x| | | | | | | complex | | | | | |x|x|x|x|x|x|x|x|x|x|x|x|x| | | | | | | symbol |x|x|x|x| | | | | | | | | | | | | | |x| | |x| | | assoc |x| | | | | | | | | | | | | | | | | | |x|x| | | | hash-table | | | | | | | | | | | | | | | | | | | |x|x| | | | signed-byte | | | | |x|x|x|x|x|x| | | | | | | | | | | | |x|x| unsigned-byte | | | | |x|x|x|x|x|x| | | | | | | | | | | | |x|x|

func CoerceToList added in v1.0.0

func CoerceToList(arg Object) (result Object)

CoerceToList coerce to a list or panic.

func CoerceToOctets added in v1.0.0

func CoerceToOctets(arg Object) (result Object)

CoerceToOctets coerces to an octets or panic.

func CoerceToString added in v1.0.0

func CoerceToString(arg Object) (result Object)

CoerceToString coerce to a string or panic.

func CoerceToVector added in v1.0.0

func CoerceToVector(arg Object, mods ...Object) (result Object)

CoerceToVector coerce to vector or panic

func Compile

func Compile(src []byte, s *Scope) (result Object)

Compile LISP source code and return an Object.

func CompileList

func CompileList(list List) (f Object)

CompileList a list into a function or an undefined function.

func CompileString

func CompileString(src string, s *Scope) Object

CompileString LISP string source code and return an Object.

func ControlErrorNew added in v1.3.1

func ControlErrorNew(s *Scope, depth int, format string, args ...any) Object

ControlErrorNew creates a ControlError (control-error) describing a control error.

func DefaultPreSet

func DefaultPreSet(p *Package, name string, value Object) (string, Object)

DefaultPreSet is the default function for package PreSet.

func DivisionByZeroNew added in v1.3.1

func DivisionByZeroNew(s *Scope, depth int, operation Object, operands List, format string, args ...any) Object

DivisionByZeroNew creates a DivisionByZeroPanic (arithmetic-error) describing a arithmetic error.

func EndOfFileNew added in v1.3.1

func EndOfFileNew(s *Scope, depth int, stream Stream, format string, args ...any) Object

EndOfFileNew returns a new EndOfFile (end-of-file) describing a stream error.

func ErrorNew added in v1.3.1

func ErrorNew(s *Scope, depth int, format string, args ...any) Object

ErrorNew returns an Error object that can then be used with a call to panic.

func EvalArg

func EvalArg(s *Scope, args List, index, depth int) (v Object)

EvalArg converts lists arguments to functions and replaces the argument. Then the argument is evaluated and returned. Non-list arguments are just evaluated.

func FileErrorNew added in v1.3.1

func FileErrorNew(s *Scope, depth int, pathname Object, format string, args ...any) Object

FileErrorNew creates a FilePanic (file-error) describing a file error.

func GetArgsKeyValue added in v0.7.0

func GetArgsKeyValue(args List, key Symbol) (value Object, has bool)

GetArgsKeyValue returns the value for a key in args. Args must be the arguments after any required or optional arguments.

func GetVar

func GetVar(sym Symbol) (Object, bool)

GetVar get the value bound to the sym argument. It panics if sym is unbound.

func InvalidMethodErrorNew added in v1.3.1

func InvalidMethodErrorNew(s *Scope, depth int, class, qualifier, name Object, format string, args ...any) Object

InvalidMethodErrorNew raises a invalid-method-error describing a invalid-method-error error.

func ListToFunc

func ListToFunc(s *Scope, list List, depth int) Object

ListToFunc converts a list to a function.

func NewCondition added in v1.3.1

func NewCondition(report Object) Object

NewCondition returns a condition.

func NewSeriousCondition added in v1.3.1

func NewSeriousCondition() Object

NewSeriousCondition creates a serious-condition.

func NewWarning added in v0.7.0

func NewWarning(format string, args ...any) Object

NewWarning returns a Warning object.

func NoApplicableMethodErrorNew added in v1.3.1

func NoApplicableMethodErrorNew(s *Scope, depth int, gf Object, fargs List, format string, args ...any) Object

NoApplicableMethodErrorNew raises a no-applicable-method-error describing a no-applicable-method-error error.

func NormalizeNumber added in v1.0.0

func NormalizeNumber(v0, v1 Object) (n0, n1 Object)

NormalizeNumber normalizes numbers to the highest precedence where precedence is (lowest to highest) fixnum, bignum, ratio, single-float, double-float, long-float, complex. signed-byte and unsigned-byte are converted to bignum.

func PackageErrorNew added in v1.3.1

func PackageErrorNew(s *Scope, depth int, pkg *Package, format string, args ...any) Object

PackageErrorNew returns a new PackageError (package-error) describing a package error.

func ParseErrorNew added in v1.3.1

func ParseErrorNew(s *Scope, depth int, format string, args ...any) Object

ParseErrorNew creates a ParsePanic (parse-error) describing a parse error.

func PrintNotReadableNew added in v1.3.1

func PrintNotReadableNew(s *Scope, depth int, object Object, format string, args ...any) Object

PrintNotReadableNew creates a print-not-readable error.

func ProgramErrorNew added in v1.3.1

func ProgramErrorNew(s *Scope, depth int, format string, args ...any) Object

ProgramErrorNew creates a ProgramPanic (program-error) describing a program error.

func ReaderErrorNew added in v1.3.1

func ReaderErrorNew(s *Scope, depth int, stream Stream, format string, args ...any) Object

ReaderErrorNew creates a ReaderError (reader-error) describing a parse error.

func SimpleObject

func SimpleObject(val any) (obj Object)

SimpleObject creates an Object from simple data.

func StreamErrorNew added in v1.3.1

func StreamErrorNew(s *Scope, depth int, stream Stream, format string, args ...any) Object

StreamErrorNew returns a new StreamError (stream-error) describing a stream error.

func TimeComponents added in v0.9.7

func TimeComponents(s *Scope, obj Time, args List, depth int) Object

TimeComponents returns a list of the time components as (year month day hour minute second nanosecond weekday).

func ToOctet added in v1.0.0

func ToOctet(arg Object) (result Object)

ToOctet coerces a value into an octet if possible.

func TypeErrorNew added in v1.3.1

func TypeErrorNew(s *Scope, depth int, use string, value Object, wants ...string) Object

TypeErrorNew returns a new type-error describing an incorrect type being used.

func UnboundSlotNew added in v1.3.1

func UnboundSlotNew(s *Scope, depth int, instance Object, name Object, format string, args ...any) Object

UnboundSlotNew raises a UnboundSlot (unbound-slot) describing a unbound-slot error.

func UnboundVariableNew added in v1.3.1

func UnboundVariableNew(s *Scope, depth int, name Object, format string, args ...any) Object

UnboundVariableNew returns a new UnboundVariable (unbound-variable) describing a unbound-variable error.

func UndefinedFunctionNew added in v1.3.1

func UndefinedFunctionNew(s *Scope, depth int, name Object, format string, args ...any) Object

UndefinedFunctionNew returns a new UndefinedFunction (undefined-function) describing a undefined-function error.

type Octet added in v0.9.5

type Octet byte

Octet is a unsigned 8 bit integer.

func (Octet) Append added in v0.9.5

func (obj Octet) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (Octet) Equal added in v0.9.5

func (obj Octet) Equal(other Object) (eq bool)

Equal returns true if this Object and the other are equal in value.

func (Octet) Eval added in v0.9.5

func (obj Octet) Eval(s *Scope, depth int) Object

Eval returns self.

func (Octet) Hierarchy added in v0.9.5

func (obj Octet) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (Octet) Int64 added in v0.9.5

func (obj Octet) Int64() int64

Int64 of the number.

func (Octet) IntegerType added in v0.9.5

func (obj Octet) IntegerType() Symbol

IntegerType returns 'octet.

func (Octet) IsInt64 added in v1.0.0

func (obj Octet) IsInt64() bool

IsInt64 returns true if the instance can be represented by an int64.

func (Octet) LoadForm added in v1.3.1

func (obj Octet) LoadForm() Object

LoadForm returns a form that can be evaluated to create the object.

func (Octet) NumberType added in v0.9.5

func (obj Octet) NumberType() Symbol

NumberType returns 'octet.

func (Octet) RationalType added in v0.9.5

func (obj Octet) RationalType() Symbol

RationalType returns 'octet.

func (Octet) Readably added in v1.3.1

func (obj Octet) Readably(b []byte, p *Printer) []byte

Readably appends the object to a byte slice. If p.Readbly is true the objects is appended in a readable format otherwise a simple append which may or may not be readable.

func (Octet) RealType added in v0.9.5

func (obj Octet) RealType() Symbol

RealType returns 'octet.

func (Octet) RealValue added in v0.9.5

func (obj Octet) RealValue() float64

RealValue of the number as a float64.

func (Octet) Simplify added in v0.9.5

func (obj Octet) Simplify() any

Simplify the Object into an int64.

func (Octet) String added in v0.9.5

func (obj Octet) String() string

String representation of the Object.

type Octets added in v0.9.5

type Octets []byte

Octets is a octets Object.

func NewOctets added in v0.9.5

func NewOctets(dim int, initElement Octet) Octets

NewOctets creates a new Octets. If fillPtr is not used then it should be -1.

func (Octets) Adjust added in v1.0.0

func (obj Octets) Adjust(dims []int, eType Symbol, initVal Object, initContent List, fillPtr int) VectorLike

Adjust array with new parameters.

func (Octets) Adjustable added in v1.0.0

func (obj Octets) Adjustable() bool

Adjustable returns true if the array is adjustable.

func (Octets) Append added in v0.9.5

func (obj Octets) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (Octets) ArrayType added in v0.9.5

func (obj Octets) ArrayType() Symbol

ArrayType returns 'octets.

func (Octets) AsList added in v0.9.5

func (obj Octets) AsList() List

AsList the Object into a list.

func (Octets) Dimensions added in v1.0.0

func (obj Octets) Dimensions() []int

Dimensions of the array.

func (Octets) ElementType added in v1.0.0

func (obj Octets) ElementType() Symbol

ElementType returns the element-type of the array.

func (Octets) Equal added in v0.9.5

func (obj Octets) Equal(other Object) (eq bool)

Equal returns true if this Object and the other are equal in value.

func (Octets) Eval added in v0.9.5

func (obj Octets) Eval(s *Scope, depth int) Object

Eval returns self.

func (Octets) Get added in v1.0.0

func (obj Octets) Get(indexes ...int) Object

Get the value at the location identified by the indexes.

func (Octets) Hierarchy added in v0.9.5

func (obj Octets) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (Octets) Length added in v0.9.5

func (obj Octets) Length() int

Length returns the length of the object.

func (Octets) LoadForm added in v1.3.1

func (obj Octets) LoadForm() Object

LoadForm returns a form that can be evaluated to create the object.

func (Octets) MajorGet added in v1.0.0

func (obj Octets) MajorGet(index int) Object

MajorGet for the index provided.

func (Octets) MajorIndex added in v1.0.0

func (obj Octets) MajorIndex(indexes ...int) int

MajorIndex for the indexes provided.

func (Octets) MajorSet added in v1.0.0

func (obj Octets) MajorSet(index int, value Object)

MajorSet for the index provided.

func (Octets) Rank added in v1.0.0

func (obj Octets) Rank() int

Rank of the array is returned,

func (Octets) SequenceType added in v0.9.5

func (obj Octets) SequenceType() Symbol

SequenceType returns 'octets.

func (Octets) Set added in v1.0.0

func (obj Octets) Set(value Object, indexes ...int)

Set a value at the location identified by the indexes.

func (Octets) SetElementType added in v1.0.0

func (obj Octets) SetElementType(ts Object)

SetElementType sets the element-type of the array.

func (Octets) Simplify added in v0.9.5

func (obj Octets) Simplify() any

Simplify the Object into a []any.

func (Octets) String added in v0.9.5

func (obj Octets) String() string

String representation of the Object.

type OutputStream

type OutputStream struct {
	Writer io.Writer
}

OutputStream is a *os.Output.

func (*OutputStream) Append

func (obj *OutputStream) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (*OutputStream) Close added in v1.0.0

func (obj *OutputStream) Close() (err error)

Close the write if it is a io.Closer

func (*OutputStream) Equal

func (obj *OutputStream) Equal(other Object) bool

Equal returns true if this Object and the other are equal in value.

func (*OutputStream) Eval

func (obj *OutputStream) Eval(s *Scope, depth int) Object

Eval returns self.

func (*OutputStream) Hierarchy

func (obj *OutputStream) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (*OutputStream) IsOpen added in v1.0.0

func (obj *OutputStream) IsOpen() (open bool)

IsOpen return true if the stream is open or false if not.

func (*OutputStream) LastByte added in v1.0.0

func (obj *OutputStream) LastByte() byte

LastByte returns the last byte written or zero if nothing has been written.

func (*OutputStream) Simplify

func (obj *OutputStream) Simplify() any

Simplify the Object into an int64.

func (*OutputStream) StreamType

func (obj *OutputStream) StreamType() Symbol

StreamType returns 'outputStream.

func (*OutputStream) String

func (obj *OutputStream) String() string

String representation of the Object.

func (*OutputStream) Write

func (obj *OutputStream) Write(b []byte) (int, error)

Write made visible since os.Output functions are not automatically visible.

type Package

type Package struct {
	Name      string
	Nicknames []string
	Doc       string
	Imports   map[string]*Import
	Uses      []*Package
	Users     []*Package
	Exports   []string

	PreSet func(p *Package, name string, value Object) (string, Object)

	Locked bool
	// contains filtered or unexported fields
}

Package represents a LISP package.

func AllPackages added in v0.9.5

func AllPackages() []*Package

AllPackages returns a list of all packages.

func DefPackage

func DefPackage(name string, nicknames []string, doc string) *Package

DefPackage creates a new package. Calling Import() and Use() after creation is expected.

func FindPackage

func FindPackage(name string) *Package

FindPackage returns the package matching the provided name.

func PackageFromArg added in v0.9.5

func PackageFromArg(arg Object) (pkg *Package)

PackageFromArg returns a package from an argument or panics.

func UnpackName added in v0.9.5

func UnpackName(str string) (pkg *Package, name string, private bool)

UnpackName separates the package from the name of a string and returns the package if one was specified, the name, and an indicator that private access is okay which was indicated by the use of a "::" separator.

func (*Package) AllClasses added in v1.3.1

func (obj *Package) AllClasses() []Class

AllClasses returns list of all classes visible in the package.

func (*Package) Append

func (obj *Package) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (*Package) DefConst added in v1.1.0

func (obj *Package) DefConst(name string, value Object, doc string) (vv *VarVal)

DefConst a constant.

func (*Package) DefLambda added in v0.8.0

func (obj *Package) DefLambda(name string, lam *Lambda, fc func(args List) Object, kind Symbol) (fi *FuncInfo)

DefLambda registers a named lambda function. This is called by defun.

func (*Package) Define

func (obj *Package) Define(creator func(args List) Object, doc *FuncDoc, aux ...any) *FuncInfo

Define a new golang function.

func (*Package) Describe

func (obj *Package) Describe(b []byte, indent, right int, ansi bool) []byte

Describe the instance in detail.

func (*Package) EachClass added in v1.3.1

func (obj *Package) EachClass(cb func(c Class))

EachClass call the cb for each class in the package.

func (*Package) EachClassName added in v1.3.1

func (obj *Package) EachClassName(cb func(name string))

EachClassName call the cb for each class in the package.

func (*Package) EachFuncInfo added in v0.8.0

func (obj *Package) EachFuncInfo(cb func(fi *FuncInfo))

EachFuncInfo call the cb for each function in the package.

func (*Package) EachFuncName added in v0.8.0

func (obj *Package) EachFuncName(cb func(name string))

EachFuncName call the cb for each function name in the package.

func (*Package) EachVarName added in v0.8.0

func (obj *Package) EachVarName(cb func(name string))

EachVarName call the cb for each function name in the package.

func (*Package) EachVarVal added in v0.8.0

func (obj *Package) EachVarVal(cb func(name string, vv *VarVal))

EachVarVal call the cb for each var in the package.

func (*Package) Equal

func (obj *Package) Equal(other Object) (eq bool)

Equal returns true if this Object and the other are equal in value.

func (*Package) Eval

func (obj *Package) Eval(s *Scope, depth int) Object

Eval returns self.

func (*Package) Export added in v0.9.5

func (obj *Package) Export(name string)

Export a function.

func (*Package) FindClass added in v1.3.1

func (obj *Package) FindClass(name string) (c Class)

Find finds the named class.

func (*Package) Get

func (obj *Package) Get(name string) (value Object, has bool)

Get a variable.

func (*Package) GetFunc added in v0.8.0

func (obj *Package) GetFunc(name string) (fi *FuncInfo)

GetFunc returns the FuncInfo associated with the name which must be lowercase.

func (*Package) GetVarVal

func (obj *Package) GetVarVal(name string) (vv *VarVal)

GetVarVal a variable.

func (*Package) Has

func (obj *Package) Has(name string) (has bool)

Has a variable.

func (*Package) Hierarchy

func (obj *Package) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (*Package) Import

func (obj *Package) Import(pkg *Package, varName string)

Import another package variable

func (*Package) Initialize added in v0.8.0

func (obj *Package) Initialize(vars map[string]*VarVal, local ...any)

Initialize the package.

func (*Package) JustGet

func (obj *Package) JustGet(name string) (value Object)

JustGet a variable.

func (*Package) LoadForm added in v1.3.1

func (obj *Package) LoadForm() Object

LoadForm returns a form that can be evaluated to create the object.

func (*Package) LoadPath added in v1.1.0

func (obj *Package) LoadPath() string

LoadPath returns then load path if the package was imported by the require function.

func (*Package) PkgPath added in v1.1.0

func (obj *Package) PkgPath() string

PkgPath returns then go package path.

func (*Package) Readably added in v1.3.1

func (obj *Package) Readably(b []byte, p *Printer) []byte

Readably appends the object to a byte slice. If p.Readbly is true the objects is appended in a readable format otherwise a simple append which may or may not be readable.

func (*Package) RegisterClass added in v1.3.1

func (obj *Package) RegisterClass(name string, c Class)

RegisterClass registers a class in the package

func (*Package) Remove

func (obj *Package) Remove(name string) (removed bool)

Remove a variable.

func (*Package) Set

func (obj *Package) Set(name string, value Object, privates ...bool) (vv *VarVal)

Set a variable.

func (*Package) SetIfHas added in v0.9.5

func (obj *Package) SetIfHas(name string, value Object, private bool) (vv *VarVal)

SetIfHas sets a variable if the package has that variable.

func (*Package) Simplify

func (obj *Package) Simplify() any

Simplify the Object into an int64.

func (*Package) String

func (obj *Package) String() string

String representation of the Object.

func (*Package) Undefine added in v0.9.0

func (obj *Package) Undefine(name string)

Undefine a function.

func (*Package) Unexport added in v0.9.5

func (obj *Package) Unexport(name string)

Unexport a function.

func (*Package) Unuse added in v0.9.5

func (obj *Package) Unuse(pkg *Package)

Unuse a package

func (*Package) Use

func (obj *Package) Use(pkg *Package)

Use another package

type Panic

type Panic struct {
	Message   string
	Condition Instance

	Value Object // used when the panic function is called
	Fatal bool   // used in repl to indicate an exit should be made
	// contains filtered or unexported fields
}

Panic is used to gather a stack trace when panic occurs.

func WrapError added in v1.3.1

func WrapError(s *Scope, obj Instance, name string, args List) *Panic

WrapError creates a Panic that wraps a Instance which is expected to be a clos condition.

func (*Panic) Append added in v1.3.1

func (p *Panic) Append(b []byte) []byte

Append the object to a byte slice.

func (*Panic) AppendFull added in v0.7.0

func (p *Panic) AppendFull(b []byte) []byte

AppendFull appends the message and stack of the error to a byte slice.

func (*Panic) AppendToStack added in v0.7.0

func (p *Panic) AppendToStack(name string, args List)

AppendToStack appends a function name and argument to the stack.

func (*Panic) Equal added in v0.7.0

func (p *Panic) Equal(other Object) bool

Equal returns true if this Object and the other are equal in value.

func (*Panic) Error

func (p *Panic) Error() string

Error returns the panic message.

func (*Panic) Eval added in v0.7.0

func (p *Panic) Eval(s *Scope, depth int) Object

Eval the object.

func (*Panic) Hierarchy added in v1.3.1

func (p *Panic) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (*Panic) Simplify added in v1.3.1

func (p *Panic) Simplify() any

Simplify the Object into simple go types of nil, bool, int64, float64, string, []any, map[string]any, or time.Time.

func (*Panic) Stack

func (p *Panic) Stack() []string

Stack returns the call stack for the error.

func (*Panic) String added in v1.3.1

func (p *Panic) String() string

String returns the panic message.

type PartialPanic added in v0.7.0

type PartialPanic struct {
	// Depth of the read when EOF encountered.
	Depth int
	// Message for the error.
	Message string
}

PartialPanic read panic.

func NewPartial added in v0.7.0

func NewPartial(depth int, format string, args ...any) *PartialPanic

NewPartial creates a new PartialPanic.

func (*PartialPanic) Error added in v1.3.1

func (pp *PartialPanic) Error() string

Error

type Placer

type Placer interface {
	Funky
	// Place the value in the location that the function would normally return
	// with an Eval with the same arguments.
	Place(s *Scope, args List, value Object)

	// SkipArgEval returns true if the argument eval should be skipped.
	SkipArgEval(i int) (skip bool)
}

Placer interface for use with functions or macros that expect a placer. (e.g., setf, incf)

type Printer

type Printer struct {

	// ANSI backs *print-ansi*.
	ANSI bool

	// Array backs *print-array*.
	Array bool

	// Base backs *print-base*.
	Base uint

	// Case backs *print-case*. A value of nil indicates no transformation.
	Case Object

	// Circle backs *print-circle*.
	Circle bool

	// Escape backs *print-escape*.
	Escape bool

	// Gensym backs *print-gensym*.
	Gensym bool

	// Lambda should be printed readably *print-lambda* .
	Lambda bool

	// Length backs *print-length*.
	Length uint

	// Level backs *print-level*.
	Level uint

	// Lines backs *print-lines*.
	Lines uint

	// MiserWidth *print-miser-width*.
	MiserWidth uint

	// Pretty backs *print-pretty*.
	Pretty bool

	// Radix backs *print-radix*.
	Radix bool

	// Readably *print-readably* .
	Readably bool

	// ReadablyError if true non-readably objects will generate an error.
	ReadablyError bool

	// RightMargin *print-right-margin*.
	RightMargin uint

	// Prec backs *print-precision*.
	Prec int
}

Printer of Objects. The values of it's members determine how Objects will be encoded for printing.

func DefaultPrinter

func DefaultPrinter() *Printer

DefaultPrinter returns the default Printer.

func (*Printer) Append

func (p *Printer) Append(b []byte, obj Object, level int) []byte

Append an Object to a byte array using the Printer variables.

func (*Printer) ScopedUpdate added in v1.0.0

func (p *Printer) ScopedUpdate(s *Scope)

ScopedUpdate updates the printer based on values of the values in the provided Scope.

func (*Printer) Write

func (p *Printer) Write(obj Object)

Write an Object to *standard-output* using the Printer variables.

type Ratio

type Ratio big.Rat

Ratio is a numerator and denominator pair.

func NewBigRatio added in v1.0.0

func NewBigRatio(num, denom *big.Int) *Ratio

NewBigRatio creates a new Ratio.

func NewRatio

func NewRatio(num, denom int64) *Ratio

NewRatio creates a new Ratio.

func (*Ratio) Append

func (obj *Ratio) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (*Ratio) Equal

func (obj *Ratio) Equal(other Object) (eq bool)

Equal returns true if this Object and the other are equal in value.

func (*Ratio) Eval

func (obj *Ratio) Eval(s *Scope, depth int) Object

Eval returns self.

func (*Ratio) Hierarchy

func (obj *Ratio) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (*Ratio) LoadForm added in v1.3.1

func (obj *Ratio) LoadForm() Object

LoadForm returns a form that can be evaluated to create the object.

func (*Ratio) NumberType

func (obj *Ratio) NumberType() Symbol

NumberType returns 'ratio.

func (*Ratio) RationalType

func (obj *Ratio) RationalType() Symbol

RationalType returns 'ratio.

func (*Ratio) Readably added in v1.3.1

func (obj *Ratio) Readably(b []byte, p *Printer) []byte

Readably appends the object to a byte slice. If p.Readbly is true the objects is appended in a readable format otherwise a simple append which may or may not be readable.

func (*Ratio) RealType

func (obj *Ratio) RealType() Symbol

RealType returns 'ratio.

func (*Ratio) RealValue

func (obj *Ratio) RealValue() float64

RealValue of the number as a float64.

func (*Ratio) Simplify

func (obj *Ratio) Simplify() any

Simplify the Object into an int64.

func (*Ratio) String

func (obj *Ratio) String() string

String representation of the Object.

type Rational

type Rational interface {
	Real

	// RationalType returns the rational type of the instance which can be one
	// of: fixnum, bignum, or ratio.
	RationalType() Symbol
}

Rational exists to allow assertions to determine if an Object is an rational.

type Readble added in v1.3.1

type Readble interface {
	// Readably appends the object to a byte slice. If p.Readbly is true the
	// objects is appended in a readable format otherwise a simple append
	// which may or may not be readable.
	Readably(b []byte, p *Printer) []byte
}

Readble identifies objects that can be written readably.

type Real

type Real interface {
	Number

	// RealType returns the real type of the instance which can be one of:
	// fixnum, bignum, float, or ratio.
	RealType() Symbol

	// RealValue of the number as a float64.
	RealValue() float64
}

Real exists to allow assertions to determine if an Object is an real.

type Receiver added in v1.3.1

type Receiver interface {
	// Receive a method invocation from the send function. Not intended to be
	// called by any code other than the send function but is public to allow
	// it to be over-ridden.
	Receive(s *Scope, message string, args List, depth int) Object
}

Receiver handles methods invoked with the send function. Typically these are Instances or a type that embeds an Instance.

type Ref added in v1.3.1

type Ref struct {
	Instance Instance
	Key      Symbol
}

Ref refers to an instance slot value.

func (*Ref) Append added in v1.3.1

func (ref *Ref) Append(b []byte) []byte

Append the object to a byte slice.

func (*Ref) Equal added in v1.3.1

func (ref *Ref) Equal(other Object) (eq bool)

Equal returns true if this Object and the other are equal in value.

func (*Ref) Eval added in v1.3.1

func (ref *Ref) Eval(s *Scope, depth int) (v Object)

Eval the object.

func (*Ref) Get added in v1.3.1

func (ref *Ref) Get() Object

Get then value referenced.

func (*Ref) Hierarchy added in v1.3.1

func (ref *Ref) Hierarchy() (hierarchy []Symbol)

Hierarchy returns the class hierarchy as symbols for the instance.

func (*Ref) Simplify added in v1.3.1

func (ref *Ref) Simplify() (simple any)

Simplify the Object into simple go types of nil, bool, int64, float64, string, []any, map[string]any, or time.Time.

func (*Ref) String added in v1.3.1

func (ref *Ref) String() string

type ReturnResult added in v0.9.5

type ReturnResult struct {
	// Tag can be either a Symbol or nil and identifies the block name that
	// the results should returned from.
	Tag Object
	// Result to return.
	Result Object
}

ReturnResult is returned by the return-from function.

func (*ReturnResult) Append added in v0.9.5

func (rr *ReturnResult) Append(b []byte) []byte

Append the object to a byte slice.

func (*ReturnResult) Equal added in v0.9.5

func (rr *ReturnResult) Equal(other Object) bool

Equal returns true if this Object and the other are equal in value.

func (*ReturnResult) Eval added in v0.9.5

func (rr *ReturnResult) Eval(s *Scope, depth int) Object

Eval the object.

func (*ReturnResult) Hierarchy added in v0.9.5

func (rr *ReturnResult) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (*ReturnResult) Simplify added in v0.9.5

func (rr *ReturnResult) Simplify() any

Simplify the Object into simple go types of nil, bool, int64, float64, string, []any, map[string]any, or time.Time.

func (*ReturnResult) String added in v0.9.5

func (rr *ReturnResult) String() string

String returns a string representation of the object.

type RuneReader added in v1.3.1

type RuneReader struct {
	Reader io.Reader
	// contains filtered or unexported fields
}

RuneReader is an *os.Reader wrapped to support runes.

func (*RuneReader) Close added in v1.3.1

func (obj *RuneReader) Close() (err error)

Close the reader if it is a io.Closer

func (*RuneReader) IsOpen added in v1.3.1

func (obj *RuneReader) IsOpen() bool

IsOpen return true if the stream is open or false if not. Note that EOF also indicates closed.

func (*RuneReader) PushRune added in v1.3.1

func (obj *RuneReader) PushRune(r rune)

PushRune makes the rune argument the next rune to be read.

func (*RuneReader) Read added in v1.3.1

func (obj *RuneReader) Read(b []byte) (cnt int, err error)

Read made visible since os.Read functions are not automatically visible.

func (*RuneReader) ReadByte added in v1.3.1

func (obj *RuneReader) ReadByte() (b byte, err error)

ReadByte reads a byte.

func (*RuneReader) ReadRune added in v1.3.1

func (obj *RuneReader) ReadRune() (r rune, size int, err error)

ReadRune reads a rune.

func (*RuneReader) UnreadRune added in v1.3.1

func (obj *RuneReader) UnreadRune() (err error)

UnreadRune unreads a rune.

type RuneStream added in v1.3.1

type RuneStream interface {
	io.Reader
	io.Closer
	io.RuneScanner
	io.ByteReader

	// IsOpen return true if the stream is open or false if not. Note that EOF
	// also indicates closed.
	IsOpen() bool
}

RuneStream defines functions to support reading streams of runes.

type Scope

type Scope struct {
	Name Object // can be nil so type can't be Symbol
	Vars map[string]Object

	Block   bool
	TagBody bool
	Macro   bool
	Keep    bool
	// contains filtered or unexported fields
}

Scope encapsulates the scope for a function.

func NewScope

func NewScope() *Scope

NewScope create a new top level Scope.

func (*Scope) AddParent added in v0.7.0

func (s *Scope) AddParent(p *Scope)

AddParent adds a parent to the scope.

func (*Scope) AllVars added in v0.7.0

func (s *Scope) AllVars() map[string]Object

AllVars returns a map of all the variables in the scope and it's parents.

func (*Scope) Bound

func (s *Scope) Bound(sym Symbol) bool

Bound returns true if the variable is bound.

func (*Scope) Eval

func (s *Scope) Eval(obj Object, depth int) (result Object)

Eval evaluates an object and returns the result.

func (*Scope) Get

func (s *Scope) Get(sym Symbol) Object

Get a named variable value.

func (*Scope) Has

func (s *Scope) Has(sym Symbol) bool

Has returns true if the variable is exists.

func (*Scope) InBlock added in v0.9.0

func (s *Scope) InBlock(name Object) bool

InBlock returns true if the scope is a block and has a matching name or one of the parents IsBlock() returns true.

func (*Scope) Let

func (s *Scope) Let(sym Symbol, value Object)

Let a symbol be bound to the value in this Scope.

func (*Scope) LocalGet added in v0.7.0

func (s *Scope) LocalGet(sym Symbol) (Object, bool)

LocalGet a named variable value.

func (*Scope) Lock added in v1.3.1

func (s *Scope) Lock()

Lock the scope to synchronize changes.

func (*Scope) NewScope

func (s *Scope) NewScope() *Scope

NewScope create a new Scope with a parent of the current Scope.

func (*Scope) Parents added in v0.7.0

func (s *Scope) Parents() []*Scope

Parents returns the parent scope or nil.

func (*Scope) Remove

func (s *Scope) Remove(sym Symbol) bool

Remove a variable binding.

func (*Scope) Set

func (s *Scope) Set(sym Symbol, value Object)

Set a variable to the provided value. If sym is bound in this scope the binding is changed to the new value. If not then the parent Set() is called. If no bindings are found before reaching the World then a new world level binding is created.

func (*Scope) SetSynchronized added in v1.3.1

func (s *Scope) SetSynchronized(on bool)

SetSynchronized set the synchronized mode of the scope.

func (*Scope) String added in v0.7.0

func (s *Scope) String() string

String returns a string representation of the scope.

func (*Scope) Synchronized added in v1.3.1

func (s *Scope) Synchronized() bool

Synchronized returns true if the scope is in synchronized mode.

func (*Scope) Unlock added in v1.3.1

func (s *Scope) Unlock()

Unlock the scope to synchronize changes.

func (*Scope) UnsafeLet

func (s *Scope) UnsafeLet(sym Symbol, value Object)

UnsafeLet a symbol be bound to the value in this Scope. No case conversion is performed and no checks are performed.

type ScopedAppender added in v1.3.1

type ScopedAppender interface {
	ScopedAppend(b []byte, s *Scope, p *Printer, level int) []byte
}

ScopedAppender is an interface for custom appenders that make use of the scope and level.

type Sequence

type Sequence interface {
	// SequenceType returns the sequence type of the instance which can be one
	// of: string, list, or vector. Breaking with the LISP standard, some
	// other types also support the interface.
	SequenceType() Symbol
}

Sequence exists to allow assertions to determine if an Object is a sequence.

type ShortFloat

type ShortFloat = SingleFloat

ShortFloat is a float32 Object.

type SignedByte added in v1.0.0

type SignedByte struct {
	Bytes []byte // low bits at the end, big-endian unsigned
}

SignedByte represents an integer with a specific number of bits. The Bytes are the absolute value of the integer value of the instance.

func SignedByteFromBigInt added in v1.0.0

func SignedByteFromBigInt(bi *big.Int) *SignedByte

SignedByteFromBigInt creates a new signed-byte from an big.Int.

func SignedByteFromInt64 added in v1.0.0

func SignedByteFromInt64(i64 int64) *SignedByte

SignedByteFromInt64 creates a new signed-byte from an int64.

func SignedByteFromUint64 added in v1.0.0

func SignedByteFromUint64(u64 uint64) *SignedByte

SignedByteFromUint64 creates a new signed-byte from an uint64.

func (*SignedByte) Append added in v1.0.0

func (obj *SignedByte) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (*SignedByte) AsFixOrBig added in v1.0.0

func (obj *SignedByte) AsFixOrBig() Object

AsFixOrBig returns the fixnum or bignum equivalent.

func (*SignedByte) Dup added in v1.0.0

func (obj *SignedByte) Dup() *SignedByte

Dup returns a copy of the instance.

func (*SignedByte) Equal added in v1.0.0

func (obj *SignedByte) Equal(other Object) (eq bool)

Equal returns true if this Object and the other are equal in value.

func (*SignedByte) Eval added in v1.0.0

func (obj *SignedByte) Eval(s *Scope, depth int) Object

Eval returns self.

func (*SignedByte) Hierarchy added in v1.0.0

func (obj *SignedByte) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (*SignedByte) Int64 added in v1.0.0

func (obj *SignedByte) Int64() (i int64)

Int64 of the number.

func (*SignedByte) IntegerType added in v1.0.0

func (obj *SignedByte) IntegerType() Symbol

IntegerType returns 'signed-byte.

func (*SignedByte) IsInt64 added in v1.0.0

func (obj *SignedByte) IsInt64() (ii bool)

IsInt64 returns true if the instance can be represented by an int64.

func (*SignedByte) IsNeg added in v1.0.0

func (obj *SignedByte) IsNeg() bool

IsNeg returns true if the instance is a negative value.

func (*SignedByte) LoadForm added in v1.3.1

func (obj *SignedByte) LoadForm() Object

LoadForm returns a form that can be evaluated to create the object.

func (*SignedByte) Neg added in v1.0.0

func (obj *SignedByte) Neg()

Neg negates the value.

func (*SignedByte) NumberType added in v1.0.0

func (obj *SignedByte) NumberType() Symbol

NumberType returns 'signed-byte.

func (*SignedByte) RationalType added in v1.0.0

func (obj *SignedByte) RationalType() Symbol

RationalType returns 'signed-byte.

func (*SignedByte) RealType added in v1.0.0

func (obj *SignedByte) RealType() Symbol

RealType returns 'signed-byte.

func (*SignedByte) RealValue added in v1.0.0

func (obj *SignedByte) RealValue() (rv float64)

RealValue of the number as a float64.

func (*SignedByte) SetBit added in v1.0.0

func (obj *SignedByte) SetBit(index uint, value bool)

SetBit sets the bit at index to the value specified.

func (*SignedByte) Simplify added in v1.0.0

func (obj *SignedByte) Simplify() any

Simplify the Object into an int64.

func (*SignedByte) Size added in v1.0.0

func (obj *SignedByte) Size() int

Size of the byte is bits.

func (*SignedByte) String added in v1.0.0

func (obj *SignedByte) String() string

String representation of the Object.

type Simple

type Simple struct {
	Data any
}

Simple is a Simple Object.

func (*Simple) Append

func (obj *Simple) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (*Simple) Equal

func (obj *Simple) Equal(other Object) bool

Equal returns true if this Object and the other are equal in value.

func (*Simple) Eval

func (obj *Simple) Eval(s *Scope, depth int) Object

Eval returns self.

func (*Simple) Hierarchy

func (obj *Simple) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (*Simple) Simplify

func (obj *Simple) Simplify() any

Simplify the Object into a simple.Simple.

func (*Simple) String

func (obj *Simple) String() string

String representation of the Object.

type SingleFloat

type SingleFloat float32

SingleFloat is a float32 Object.

func (SingleFloat) Append

func (obj SingleFloat) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (SingleFloat) Equal

func (obj SingleFloat) Equal(other Object) (eq bool)

Equal returns true if this Object and the other are equal in value.

func (SingleFloat) Eval

func (obj SingleFloat) Eval(s *Scope, depth int) Object

Eval returns self.

func (SingleFloat) FloatType

func (obj SingleFloat) FloatType() Symbol

FloatType returns 'single-float.

func (SingleFloat) Hierarchy

func (obj SingleFloat) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (SingleFloat) LoadForm added in v1.3.1

func (obj SingleFloat) LoadForm() Object

LoadForm returns a form that can be evaluated to create the object.

func (SingleFloat) NumberType

func (obj SingleFloat) NumberType() Symbol

NumberType returns 'single-float.

func (SingleFloat) Readably added in v1.3.1

func (obj SingleFloat) Readably(b []byte, p *Printer) []byte

Readably appends the object to a byte slice. If p.Readbly is true the objects is appended in a readable format otherwise a simple append which may or may not be readable.

func (SingleFloat) RealType

func (obj SingleFloat) RealType() Symbol

RealType returns 'single-float.

func (SingleFloat) RealValue

func (obj SingleFloat) RealValue() float64

RealValue of the number as a float64.

func (SingleFloat) Simplify

func (obj SingleFloat) Simplify() any

Simplify the Object into a float64.

func (SingleFloat) String

func (obj SingleFloat) String() string

String representation of the Object.

type SpecialSyntax

type SpecialSyntax interface {
	// SpecialChar returns the special character for the function.
	SpecialPrefix() string

	// GetArgs returns the function arguments.
	GetArgs() List
}

SpecialSyntax identifies functions with special syntax for writing and reading. This include quote, backquote, and comma.

type Stream

type Stream interface {
	Object

	// StreamType returns the stream type of the instance which can be one of: file-stream
	StreamType() Symbol

	// IsOpen return true if the stream is open or false if not or it can not
	// be determined.
	IsOpen() bool
}

Stream exists to allow assertions to determine if an Object is an stream.

type String

type String string

String is a string Object.

func (String) Append

func (obj String) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (String) Equal

func (obj String) Equal(other Object) bool

Equal returns true if this Object and the other are equal in value.

func (String) Eval

func (obj String) Eval(s *Scope, depth int) Object

Eval returns self.

func (String) Hierarchy

func (obj String) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (String) Length

func (obj String) Length() int

Length returns the length of the object.

func (String) LoadForm added in v1.3.1

func (obj String) LoadForm() Object

LoadForm returns a form that can be evaluated to create the object.

func (String) Readably added in v1.3.1

func (obj String) Readably(b []byte, p *Printer) []byte

Readably appends the object to a byte slice. If p.Readbly is true the objects is appended in a readable format otherwise a simple append which may or may not be readable.

func (String) SequenceType

func (obj String) SequenceType() Symbol

SequenceType returns 'vector.

func (String) Simplify

func (obj String) Simplify() any

Simplify the Object into a string.

func (String) String

func (obj String) String() string

String representation of the Object.

type StringStream added in v1.0.0

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

StringStream is an input and output stream with seeker support.

func NewStringStream added in v1.0.0

func NewStringStream(content []byte) *StringStream

NewStringStream initializes a new string-stream with the provided content.

func (*StringStream) Append added in v1.0.0

func (obj *StringStream) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (*StringStream) Close added in v1.0.0

func (obj *StringStream) Close() error

Close the stream but not the input or output streams.

func (*StringStream) Content added in v1.0.0

func (obj *StringStream) Content() string

Content returns the current buffer as a string.

func (*StringStream) Equal added in v1.0.0

func (obj *StringStream) Equal(other Object) bool

Equal returns true if this Object and the other are equal in value.

func (*StringStream) Eval added in v1.0.0

func (obj *StringStream) Eval(s *Scope, depth int) Object

Eval returns self.

func (*StringStream) Hierarchy added in v1.0.0

func (obj *StringStream) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (*StringStream) IsOpen added in v1.0.0

func (obj *StringStream) IsOpen() bool

IsOpen return true if the stream is open or false if not.

func (*StringStream) LastByte added in v1.0.0

func (obj *StringStream) LastByte() (b byte)

LastByte returns the last byte written or zero if nothing has been written.

func (*StringStream) Read added in v1.0.0

func (obj *StringStream) Read(p []byte) (n int, err error)

Read from the current position in the buf. This is part of the io.Reader interface.

func (*StringStream) ReadAt added in v1.0.0

func (obj *StringStream) ReadAt(p []byte, off int64) (n int, err error)

ReadAt from the off in the buf and does not advance pos. This is part of the io.ReaderAt interface.

func (*StringStream) ReadByte added in v1.3.1

func (obj *StringStream) ReadByte() (b byte, err error)

ReadByte reads a byte.

func (*StringStream) ReadRune added in v1.0.0

func (obj *StringStream) ReadRune() (r rune, size int, err error)

ReadRune returns the next rune in buf from the current position. This is part of the io.RuneReader interface.

func (*StringStream) Seek added in v1.0.0

func (obj *StringStream) Seek(offset int64, whence int) (n int64, err error)

Seek moves the pos in buf. This is part of the io.Seeker interface.

func (*StringStream) Simplify added in v1.0.0

func (obj *StringStream) Simplify() any

Simplify the Object into string.

func (*StringStream) StreamType added in v1.0.0

func (obj *StringStream) StreamType() Symbol

StreamType returns 'stringStream.

func (*StringStream) String added in v1.0.0

func (obj *StringStream) String() string

String representation of the Object.

func (*StringStream) UnreadRune added in v1.3.1

func (obj *StringStream) UnreadRune() error

ReadByte reads a byte.

func (*StringStream) Write added in v1.0.0

func (obj *StringStream) Write(b []byte) (int, error)

Write to the current position in the buf. This is part of the io.Writer interface.

func (*StringStream) WriteAt added in v1.0.0

func (obj *StringStream) WriteAt(b []byte, off int64) (int, error)

WriteAt to the offset in the buf. The position in the buf is not changed. This is part of the io.WriterAt interface.

type Symbol

type Symbol string

Symbol is a symbol Object.

func (Symbol) Append

func (obj Symbol) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (Symbol) Equal

func (obj Symbol) Equal(other Object) bool

Equal returns true if this Object and the other are equal in value.

func (Symbol) Eval

func (obj Symbol) Eval(s *Scope, depth int) Object

Eval the symbol and return it's binding in the current scope.

func (Symbol) Hierarchy

func (obj Symbol) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (Symbol) LoadForm added in v1.3.1

func (obj Symbol) LoadForm() Object

LoadForm returns a form that can be evaluated to create the object.

func (Symbol) Readably added in v1.3.1

func (obj Symbol) Readably(b []byte, p *Printer) []byte

Readably appends the object to a byte slice. If p.Readbly is true the objects is appended in a readable format otherwise a simple append which may or may not be readable.

func (Symbol) Simplify

func (obj Symbol) Simplify() any

Simplify the Object into a string.

func (Symbol) String

func (obj Symbol) String() string

String representation of the Object.

type Tail

type Tail struct {
	Value Object // always non-nil
}

Tail is used to indicate the []Object is sons and not a list. The difference between a list and a cons in LISP is that the cdr of the last cons cell in a list is nil while if the last cdr in a list is a value then the list is actually a cons.

func (Tail) Append

func (t Tail) Append(b []byte) []byte

Append the object to a byte slice.

func (Tail) Equal

func (t Tail) Equal(other Object) bool

Equal returns true if this Object and the other are equal in value.

func (Tail) Eval

func (t Tail) Eval(s *Scope, depth int) Object

Eval the object.

func (Tail) Hierarchy

func (t Tail) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (Tail) Simplify

func (t Tail) Simplify() (a any)

Simplify the Object into simple go types of nil, bool, int64, float64, string, []any, map[string]any, or time.Time.

func (Tail) String

func (t Tail) String() string

String representation of the object.

type Time

type Time time.Time

Time is a time.Time Object. It might be better in the pkg/gi package but then it could not be used in the SimpleObject conversion function so instead it is a core (slip) type and the time related functions are in the pkg/gi package.

func (Time) Append

func (obj Time) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (Time) Class added in v0.9.7

func (obj Time) Class() Class

Class of the instance.

func (Time) Describe added in v0.9.7

func (obj Time) Describe(b []byte, indent, right int, ansi bool) []byte

Describe the instance in detail.

func (Time) Equal

func (obj Time) Equal(other Object) (eq bool)

Equal returns true if this Object and the other are equal in value.

func (Time) Eval

func (obj Time) Eval(s *Scope, depth int) Object

Eval returns self.

func (Time) HasMethod added in v0.9.7

func (obj Time) HasMethod(method string) bool

HasMethod returns true if the instance handles the named method.

func (Time) Hierarchy

func (obj Time) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (Time) Init added in v0.9.7

func (obj Time) Init(scope *Scope, args List, depth int)

Init does nothing.

func (Time) LoadForm added in v1.3.1

func (obj Time) LoadForm() Object

LoadForm returns a form that can be evaluated to create the object.

func (Time) Receive added in v0.9.7

func (obj Time) Receive(s *Scope, message string, args List, depth int) Object

Receive a method invocation from the send function. It is typically called by the send function but can be called directly so effectively send a method to an instance.

func (Time) Simplify

func (obj Time) Simplify() any

Simplify the Object into a time.Time.

func (Time) String

func (obj Time) String() string

String representation of the Object.

type Undefined

type Undefined string

Undefined represents an undefined value.

func (Undefined) Append

func (obj Undefined) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (Undefined) Equal

func (obj Undefined) Equal(other Object) bool

Equal returns true if this Object and the other are equal in value.

func (Undefined) Eval

func (obj Undefined) Eval(s *Scope, depth int) Object

Eval returns self.

func (Undefined) Hierarchy

func (obj Undefined) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (Undefined) Simplify

func (obj Undefined) Simplify() any

Simplify the Object into true.

func (Undefined) String

func (obj Undefined) String() string

String representation of the Object.

type UnsignedByte added in v1.0.0

type UnsignedByte struct {
	Bytes []byte // low bits at the end, big-endian ununsigned
}

UnsignedByte represents an integer with a specific number of bits. The type is a struct so that growing the bytes does not cause a new instance to be created.

func (*UnsignedByte) Append added in v1.0.0

func (obj *UnsignedByte) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (*UnsignedByte) AsFixOrBig added in v1.0.0

func (obj *UnsignedByte) AsFixOrBig() Object

AsFixOrBig returns the fixnum or bignum equivalent.

func (*UnsignedByte) Dup added in v1.0.0

func (obj *UnsignedByte) Dup() *UnsignedByte

Dup returns a copy of the instance.

func (*UnsignedByte) Equal added in v1.0.0

func (obj *UnsignedByte) Equal(other Object) (eq bool)

Equal returns true if this Object and the other are equal in value.

func (*UnsignedByte) Eval added in v1.0.0

func (obj *UnsignedByte) Eval(s *Scope, depth int) Object

Eval returns self.

func (*UnsignedByte) GetBit added in v1.0.0

func (obj *UnsignedByte) GetBit(index uint) (value bool)

GetBit gets the bit at index and returns a boolean value.

func (*UnsignedByte) Hierarchy added in v1.0.0

func (obj *UnsignedByte) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (*UnsignedByte) Int64 added in v1.0.0

func (obj *UnsignedByte) Int64() (i int64)

Int64 of the number.

func (*UnsignedByte) IntegerType added in v1.0.0

func (obj *UnsignedByte) IntegerType() Symbol

IntegerType returns 'unsigned-byte.

func (*UnsignedByte) Invert added in v1.0.0

func (obj *UnsignedByte) Invert()

Invert the bits or NOT (complement) of each bit.

func (*UnsignedByte) IsInt64 added in v1.0.0

func (obj *UnsignedByte) IsInt64() (ii bool)

IsInt64 returns true if the instance can be represented by an int64.

func (*UnsignedByte) LoadForm added in v1.3.1

func (obj *UnsignedByte) LoadForm() Object

LoadForm returns a form that can be evaluated to create the object.

func (*UnsignedByte) NumberType added in v1.0.0

func (obj *UnsignedByte) NumberType() Symbol

NumberType returns 'unsigned-byte.

func (*UnsignedByte) RationalType added in v1.0.0

func (obj *UnsignedByte) RationalType() Symbol

RationalType returns 'unsigned-byte.

func (*UnsignedByte) RealType added in v1.0.0

func (obj *UnsignedByte) RealType() Symbol

RealType returns 'unsigned-byte.

func (*UnsignedByte) RealValue added in v1.0.0

func (obj *UnsignedByte) RealValue() (rv float64)

RealValue of the number as a float64.

func (*UnsignedByte) SetBit added in v1.0.0

func (obj *UnsignedByte) SetBit(index uint, value bool)

SetBit sets the bit at index to the value specified.

func (*UnsignedByte) Simplify added in v1.0.0

func (obj *UnsignedByte) Simplify() any

Simplify the Object into an int64.

func (*UnsignedByte) Size added in v1.0.0

func (obj *UnsignedByte) Size() int

Size of the byte is bits.

func (*UnsignedByte) String added in v1.0.0

func (obj *UnsignedByte) String() string

String representation of the Object.

type Values

type Values []Object

Values of Objects. Only used for multiple return values.

func (Values) Append

func (obj Values) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (Values) Equal

func (obj Values) Equal(other Object) (eq bool)

Equal returns true if this Object and the other are equal in value.

func (Values) Eval

func (obj Values) Eval(s *Scope, depth int) Object

Eval panics.

func (Values) First

func (obj Values) First() Object

First value in the multiple values.

func (Values) Hierarchy

func (obj Values) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (Values) LoadForm added in v1.3.1

func (obj Values) LoadForm() Object

LoadForm returns a form that can be evaluated to create the object.

func (Values) Simplify

func (obj Values) Simplify() any

Simplify the Object into a []any.

func (Values) String

func (obj Values) String() string

String representation of the Object.

type VarVal

type VarVal struct {
	Val    Object
	Get    func() Object
	Set    func(Object)
	Doc    string
	Pkg    *Package // package interned in
	Export bool
	Const  bool
	// contains filtered or unexported fields
}

VarVal hold the information about a variable value.

func (*VarVal) Append added in v0.9.5

func (vv *VarVal) Append(b []byte) []byte

Append the object to a byte slice.

func (*VarVal) Equal added in v0.9.5

func (vv *VarVal) Equal(other Object) bool

Equal returns true if this Object and the other are equal in value.

func (*VarVal) Eval added in v0.9.5

func (vv *VarVal) Eval(s *Scope, depth int) Object

Eval the object.

func (*VarVal) Hierarchy added in v0.9.5

func (vv *VarVal) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (*VarVal) Simplify

func (vv *VarVal) Simplify() any

Simplify the Object into an int64.

func (*VarVal) String added in v0.9.5

func (vv *VarVal) String() string

String representation of the instance.

func (*VarVal) Value

func (vv *VarVal) Value() (val Object)

Value returns the value of the instance.

type Vector

type Vector struct {
	Array
	FillPtr int
}

Vector is a vector Object.

func NewVector added in v0.9.5

func NewVector(dim int, elementType Symbol, initElement Object, elements List, adjustable bool) *Vector

NewVector creates a new Vector. If fillPtr is not used then it should be -1.

func (*Vector) Adjust added in v0.9.5

func (obj *Vector) Adjust(
	dims []int,
	elementType Symbol,
	initElement Object,
	initContent List,
	fillPtr int) VectorLike

Adjust array with new parameters.

func (*Vector) Append

func (obj *Vector) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (*Vector) ArrayType

func (obj *Vector) ArrayType() Symbol

ArrayType returns 'vector.

func (*Vector) AsList added in v0.9.5

func (obj *Vector) AsList() List

AsList the Object into set of nested lists.

func (*Vector) Equal

func (obj *Vector) Equal(other Object) (eq bool)

Equal returns true if this Object and the other are equal in value.

func (*Vector) Eval

func (obj *Vector) Eval(s *Scope, depth int) Object

Eval returns self.

func (*Vector) FillPointer added in v1.0.0

func (obj *Vector) FillPointer() int

FillPointer returns the fill-pointer as an int.

func (*Vector) Hierarchy

func (obj *Vector) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (*Vector) Pop added in v0.9.5

func (obj *Vector) Pop() (element Object)

Pop a value from the vector. The vector elements are not changed if there is a fill-pointer. If there is no fill pointer then the length of the vector is shortened by one.

func (*Vector) Push added in v0.9.5

func (obj *Vector) Push(values ...Object) (index int)

Push a value onto the vector.

func (*Vector) SequenceType

func (obj *Vector) SequenceType() Symbol

SequenceType returns 'vector.

func (*Vector) SetFillPointer added in v1.0.0

func (obj *Vector) SetFillPointer(fp int)

SetFillPointer sets the fill-pointer.

func (*Vector) Simplify

func (obj *Vector) Simplify() any

Simplify the Object into a []any.

func (*Vector) String

func (obj *Vector) String() string

String representation of the Object.

type VectorLike added in v1.0.0

type VectorLike interface {
	ArrayLike

	// Adjust array with new parameters.
	Adjust(dims []int, eType Symbol, initVal Object, initContent List, fillPtr int) VectorLike
}

VectorLike is an interface that all vectors implement.

type WhopLoc added in v1.3.1

type WhopLoc struct {
	Method  *Method
	Current int
}

func (*WhopLoc) Append added in v1.3.1

func (wl *WhopLoc) Append(b []byte) []byte

Append a buffer with a representation of the Object.

func (*WhopLoc) Continue added in v1.3.1

func (wl *WhopLoc) Continue(s *Scope, args List, depth int) Object

func (*WhopLoc) Equal added in v1.3.1

func (wl *WhopLoc) Equal(other Object) (eq bool)

Equal returns true if this Object and the other are equal in value.

func (*WhopLoc) Eval added in v1.3.1

func (wl *WhopLoc) Eval(s *Scope, depth int) Object

Eval returns self.

func (*WhopLoc) HasNext added in v1.3.1

func (wl *WhopLoc) HasNext() bool

func (*WhopLoc) Hierarchy added in v1.3.1

func (wl *WhopLoc) Hierarchy() []Symbol

Hierarchy returns the class hierarchy as symbols for the whopLoc.

func (*WhopLoc) Simplify added in v1.3.1

func (wl *WhopLoc) Simplify() interface{}

Simplify by returning the string representation of the flavor.

func (*WhopLoc) String added in v1.3.1

func (wl *WhopLoc) String() string

String representation of the Object.

Directories

Path Synopsis
cmd
slip command
Package main is the main package.
Package main is the main package.
pkg
Package pkg pulls in all sub-packages.
Package pkg pulls in all sub-packages.
bag
Package bag contains the bag functions.
Package bag contains the bag functions.
cl
Package cl contains the common-lisp functions.
Package cl contains the common-lisp functions.
clos
Package clos contains the functions and types to support CLOS (Common LISP Object System).
Package clos contains the functions and types to support CLOS (Common LISP Object System).
csv
Package csv contains the functions for CSV reading and writing.
Package csv contains the functions for CSV reading and writing.
flavors
Package flavors contains the flavors functions.
Package flavors contains the flavors functions.
generic
Package generic contains the functions and types to support generics.
Package generic contains the functions and types to support generics.
gi
Package gi contains the functions that provide better integration with go so a Go Integration (GI) package.
Package gi contains the functions that provide better integration with go so a Go Integration (GI) package.
net
Package net includes networking support.
Package net includes networking support.
repl
Package repl includes the types and functions for a Read Eval Print Loop.
Package repl includes the types and functions for a Read Eval Print Loop.
repl/term
Package term provides support functions for dealing with terminals, as commonly found on UNIX systems.
Package term provides support functions for dealing with terminals, as commonly found on UNIX systems.
watch
Package watch contains the watch functions and flavors which provide a means to watch global variables and invoke lisp functions from a remote process.
Package watch contains the watch functions and flavors which provide a means to watch global variables and invoke lisp functions from a remote process.
xml
Package xml contains the functions for XML reading and writing.
Package xml contains the functions for XML reading and writing.
Package pp implements a LISP pretty printer.
Package pp implements a LISP pretty printer.
Package sliptest includes test tools for the slip package.
Package sliptest includes test tools for the slip package.
test
appplugin command
cl/testplugin command

Jump to

Keyboard shortcuts

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