utils

package
v0.0.0-...-c3dec15 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustPop

func MustPop[T any](s *[]T) T

gets last (LIFO), without checking length

func MustShift

func MustShift[T any](s *[]T) T

gets first (FIFO), without checking length

func NewDay

func NewDay[T any]() *day[T]

it's a new day

func ParseInt

func ParseInt(something string) int

func Pop

func Pop[T any](s *[]T) *T

gets last (LIFO)

func ReadAsLines

func ReadAsLines(filename string) (out []string)

func ReadCSV

func ReadCSV(filename string) (out []string)

func ReadCSVInt

func ReadCSVInt(filename string) (out []int)

func ReadLinesIter

func ReadLinesIter(filename string) iter.Seq[string]

this works fine, but didn't use it anywhere

func ReadSpaceSeparatedSections

func ReadSpaceSeparatedSections(filename string) []string

func ScanCommas

func ScanCommas(data []byte, atEOF bool) (advance int, token []byte, err error)

copied from ScanLines;

just swapped "\n" with "," naively (ignoring quoted commas)

then checked for newline within the comma check

to handle 7,1\n11,1

func Shift

func Shift[T any](s *[]T) *T

gets first (FIFO)

func Sum

func Sum[E ~int](slice []E) (out E)

not sure what E type should be

func SumFunc

func SumFunc[T any, E ~int](slice []T, fun func(_ T) E) (out E)

Types

This section is empty.

Jump to

Keyboard shortcuts

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