aoc

package
v0.0.0-...-c28410d Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsDiffInt

func AbsDiffInt[T constraints.Integer](x, y T) T

func AbsInt

func AbsInt[T constraints.Signed](x T) T

func Atoi

func Atoi(s string) int

func ClampInt

func ClampInt(i, min, max int) int

func MakeMatrix2D

func MakeMatrix2D[E any](ydim, xdim int) [][]E

func MaxFloat

func MaxFloat[T constraints.Float](a, b T) T

func MaxInteger

func MaxInteger[T constraints.Integer](a, b T) T

func MaybePanic

func MaybePanic(err error)

func MinFloat

func MinFloat[T constraints.Float](a, b T) T

func MinInteger

func MinInteger[T constraints.Integer](a, b T) T

func MustConsume

func MustConsume(s, prefix string) string

func MustCut

func MustCut(s string, sep string) (before, after string)

func ParseCommaSeparatedInt

func ParseCommaSeparatedInt(s string) []int

func ParseIntegers

func ParseIntegers(b []byte) []int

func ScanSections

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

ScanSections is a split function for a bufio.Scanner that returns sections separated by multiple newlines, stripped of any consecutive newlines. The returned section may be empty.

func SplitExact

func SplitExact(s string, sep string, n int) []string

func SplitLines

func SplitLines(b []byte) [][]byte

func SplitSections

func SplitSections(b []byte) [][]byte

func TestPart

func TestPart(t *testing.T, part func(string) string, cases []TestCase)

Types

type TestCase

type TestCase struct {
	Input string
	Want  string
}

Jump to

Keyboard shortcuts

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