lists

package module
v0.0.0-...-3be259e Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2022 License: AGPL-3.0 Imports: 0 Imported by: 0

README

go-lists

A list library for Go

Go Reference

Lists
  • StrList
  • IntList
  • Float64List

The list library is functionally similar to dynamic arrays in high level languages, where they appear to have a dynamic length. Technically, fixed length arrays have a minor performance benefit over this, however unless you're dealing with massive arrays it won't be noticeable.

Usage:

strList := lists.NewStrList()
strList.append("test")
strList.append("test2")
strList.append("test3")
fmt.Println(strList)
// ["test "test2" "test3"]

strList.SliceAt(1)
fmt.Println(strList)
// ["test" "test3"]

strList.SliceElement("test")
fmt.Println(strList)
// ["test3"]

Works the same for all types of Lists available (lists.NewStrList(), lists.NewIntList(), lists.NewFloat64List()).

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Float64List

type Float64List struct {
	Components []float64
	Length     int
}

Float64List STRING LISTS

func NewFloat64List

func NewFloat64List() Float64List

NewFloat64List exporting constructor functions

func (*Float64List) Append

func (arr *Float64List) Append(toAdd float64)

func (*Float64List) Entries

func (arr *Float64List) Entries() []float64

func (*Float64List) IndexOf

func (arr *Float64List) IndexOf(element float64) int

func (*Float64List) SliceAt

func (arr *Float64List) SliceAt(index int) bool

func (*Float64List) SliceElement

func (arr *Float64List) SliceElement(element float64) bool

type IntList

type IntList struct {
	Components []int
	Length     int
}

IntList STRING LISTS

func NewIntList

func NewIntList() IntList

NewIntList exporting constructor functions

func (*IntList) Append

func (arr *IntList) Append(toAdd int)

func (*IntList) Entries

func (arr *IntList) Entries() []int

func (*IntList) IndexOf

func (arr *IntList) IndexOf(element int) int

func (*IntList) SliceAt

func (arr *IntList) SliceAt(index int) bool

func (*IntList) SliceElement

func (arr *IntList) SliceElement(element int) bool

type StrList

type StrList struct {
	Components []string
	Length     int
}

StrList STRING LISTS

func NewStrList

func NewStrList() StrList

NewStrList exporting constructor functions

func (*StrList) Append

func (arr *StrList) Append(toAdd string)

func (*StrList) Entries

func (arr *StrList) Entries() []string

func (*StrList) IndexOf

func (arr *StrList) IndexOf(element string) int

func (*StrList) SliceAt

func (arr *StrList) SliceAt(index int) bool

func (*StrList) SliceElement

func (arr *StrList) SliceElement(element string) bool

Jump to

Keyboard shortcuts

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