bag

package
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: 15 Imported by: 0

Documentation

Overview

Package bag contains the bag functions. A bag is flexible a container for data composed of t, nil, integer, float, string, time, list, as well as the special bag::map and bag::false. It can be parsed from JSON or SEN (ojg package) and be encoded in the same way. It can also be converted to and from native LISP with bag::map becoming an assoc list. The bag::false value is the only non-native value that is retained since LISP does not differentiate between nil and boolean false.

Index

Constants

View Source
const PathSymbol = slip.Symbol("bag-path")

PathSymbol is the symbol with a value of "path".

Variables

View Source
var (
	// Pkg is the Bag package.
	Pkg = slip.Package{
		Name:      "bag",
		Nicknames: []string{},
		Doc:       "Home of symbols defined for the bag package.",
		PreSet:    slip.DefaultPreSet,
	}
)

Functions

func Flavor

func Flavor() *flavors.Flavor

Flavor returns the bag-flavor.

func ObjectToBag added in v0.7.0

func ObjectToBag(s *slip.Scope, obj slip.Object, depth int) (v any)

ObjectToBag is the same as slip.Simplify except for assoc lists which are converted to map[string]any.

func SetCompileScript added in v0.9.9

func SetCompileScript(s *slip.Scope)

SetCompileScript sets the World instance for the jp.CompileScript function.

Types

type Compare

type Compare struct {
	slip.Function
}

Compare represents the compare function.

func (*Compare) Call

func (f *Compare) Call(s *slip.Scope, args slip.List, depth int) (result slip.Object)

Call the the function with the arguments provided.

type DiscoverJSON added in v1.3.1

type DiscoverJSON struct {
	slip.Function
}

DiscoverJSON represents the DiscoverJSON function.

func (*DiscoverJSON) Call added in v1.3.1

func (f *DiscoverJSON) Call(s *slip.Scope, args slip.List, depth int) (result slip.Object)

Call the the function with the arguments provided.

type Get

type Get struct {
	slip.Function
}

Get represents the get function.

func (*Get) Call

func (f *Get) Call(s *slip.Scope, args slip.List, depth int) (result slip.Object)

Call the the function with the arguments provided.

type Has

type Has struct {
	slip.Function
}

Has represents the has function.

func (*Has) Call

func (f *Has) Call(s *slip.Scope, args slip.List, depth int) (result slip.Object)

Call the the function with the arguments provided.

type JSONParse added in v0.7.0

type JSONParse struct {
	slip.Function
}

JSONParse represents the JSONParse function.

func (*JSONParse) Call added in v0.7.0

func (f *JSONParse) Call(s *slip.Scope, args slip.List, depth int) (result slip.Object)

Call the the function with the arguments provided.

type Make added in v0.9.0

type Make struct {
	slip.Function
}

Make represents the make-bag function.

func (*Make) Call added in v0.9.0

func (f *Make) Call(s *slip.Scope, args slip.List, depth int) (result slip.Object)

Call the the function with the arguments provided.

type MakeBagPath

type MakeBagPath struct {
	slip.Function
}

MakeBagPath represents the makeBagPath function.

func (*MakeBagPath) Call

func (f *MakeBagPath) Call(s *slip.Scope, args slip.List, depth int) slip.Object

Call the function with the arguments provided.

type Modify

type Modify struct {
	slip.Function
}

Modify represents the modify function.

func (*Modify) Call

func (f *Modify) Call(s *slip.Scope, args slip.List, depth int) (result slip.Object)

Call the the function with the arguments provided.

type Native

type Native struct {
	slip.Function
}

Native represents the native function.

func (*Native) Call

func (f *Native) Call(s *slip.Scope, args slip.List, depth int) (result slip.Object)

Call the the function with the arguments provided.

type Parse

type Parse struct {
	slip.Function
}

Parse represents the parse function.

func (*Parse) Call

func (f *Parse) Call(s *slip.Scope, args slip.List, depth int) (result slip.Object)

Call the the function with the arguments provided.

type Path

type Path jp.Expr

Path is a JSONPath.

func (Path) Append

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

Append a buffer with a representation of the Object.

func (Path) Equal

func (obj Path) Equal(other slip.Object) (eq bool)

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

func (Path) Eval

func (obj Path) Eval(s *slip.Scope, depth int) slip.Object

Eval returns self.

func (Path) Hierarchy

func (obj Path) Hierarchy() []slip.Symbol

Hierarchy returns the class hierarchy as symbols for the instance.

func (Path) LoadForm added in v1.3.1

func (obj Path) LoadForm() slip.Object

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

func (Path) Simplify

func (obj Path) Simplify() interface{}

Simplify the Object into a path.Path.

func (Path) String

func (obj Path) String() string

String representation of the Object.

type Pathp

type Pathp struct {
	slip.Function
}

Pathp represents the pathp function.

func (*Pathp) Call

func (f *Pathp) Call(s *slip.Scope, args slip.List, depth int) slip.Object

Call the the function with the arguments provided.

type Procedure added in v0.9.9

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

Procedure defines the interface for functions for script fragments between [( and )] delimiters.

func (*Procedure) First added in v0.9.9

func (p *Procedure) First(data any) any

First should return a single matching in the data element or nil if there are no matches.

func (*Procedure) Get added in v0.9.9

func (p *Procedure) Get(data any) (result []any)

Get returns the result of evaluating a list of all matching elements.

type Read added in v0.7.0

type Read struct {
	slip.Function
}

Read represents the read function.

func (*Read) Call added in v0.7.0

func (f *Read) Call(s *slip.Scope, args slip.List, depth int) (result slip.Object)

Call the the function with the arguments provided.

type Remove

type Remove struct {
	slip.Function
}

Remove represents the remove function.

func (*Remove) Call

func (f *Remove) Call(s *slip.Scope, args slip.List, depth int) (result slip.Object)

Call the the function with the arguments provided.

type Set

type Set struct {
	slip.Function
}

Set represents the set function.

func (*Set) Call

func (f *Set) Call(s *slip.Scope, args slip.List, depth int) (result slip.Object)

Call the function with the arguments provided.

type Walk

type Walk struct {
	slip.Function
}

Walk represents the walk function.

func (*Walk) Call

func (f *Walk) Call(s *slip.Scope, args slip.List, depth int) slip.Object

Call the the function with the arguments provided.

type Write

type Write struct {
	slip.Function
}

Write represents the write function.

func (*Write) Call

func (f *Write) Call(s *slip.Scope, args slip.List, depth int) (result slip.Object)

Call the the function with the arguments provided.

Jump to

Keyboard shortcuts

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