util

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GraphSeparators

func GraphSeparators[K comparable](inputs []K, edges func(K) []K) ([]K, [][]K)

func SeparatorsTest

func SeparatorsTest()

func StronglyConnectedComponents

func StronglyConnectedComponents[K comparable](inputs []K, edges func(K) []K) [][]K

func StronglyConnectedTest

func StronglyConnectedTest()

Types

type SExpKindT

type SExpKindT int
const (
	SExpInt SExpKindT = iota
	SExpSymbol
	SExpList
)

type SExpT

type SExpT struct {
	Kind    SExpKindT
	Integer int
	Symbol  string
	List    []*SExpT
}

func ParseSExp

func ParseSExp(data string) *SExpT

func (*SExpT) String

func (sexp *SExpT) String() string

type SetT

type SetT[E comparable] map[E]struct{}

func NewSet

func NewSet[E comparable](members ...E) SetT[E]

func (SetT[E]) Add

func (set SetT[E]) Add(members ...E)

func (SetT[E]) Contains

func (set SetT[E]) Contains(member E) bool

func (SetT[E]) Difference

func (set SetT[E]) Difference(other SetT[E]) SetT[E]

func (SetT[E]) Intersection

func (set SetT[E]) Intersection(other SetT[E]) SetT[E]

func (SetT[E]) Members

func (set SetT[E]) Members() []E

func (SetT[E]) Pop

func (set SetT[E]) Pop() E

Removes one member of the set and returns it.

func (SetT[E]) Remove

func (set SetT[E]) Remove(member E)

func (SetT[E]) Union

func (set SetT[E]) Union(other SetT[E]) SetT[E]

type StackT

type StackT[T any] struct {
	// contains filtered or unexported fields
}

func (*StackT[T]) Len

func (stack *StackT[T]) Len() int

func (*StackT[T]) Pop

func (stack *StackT[T]) Pop() T

func (*StackT[T]) Push

func (stack *StackT[T]) Push(elt T)

func (*StackT[T]) Ref added in v0.1.1

func (stack *StackT[T]) Ref(i int) T

func (*StackT[T]) Top

func (stack *StackT[T]) Top() T

Jump to

Keyboard shortcuts

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