Documentation ¶
Overview ¶
Package utilities contains utility functions for Advent of Code solutions.
Index ¶
- func AbsInt(x int) int
- func ConvertStringSliceToIntSlice(s []string) ([]int, error)
- func Filter[T any](s []T, f func(T) bool) []T
- func GCD(a, b int) int
- func LCM(a, b int) int
- func Map[T, U any](s []T, f func(T) U) []U
- func MaxFloatSlice(arr []float64) float64
- func MeanFloatSlice(arr []float64) float64
- func MinFloatSlice(arr []float64) float64
- func Unique[T comparable](s []T) []T
- type Point2D
- type Point3D
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertStringSliceToIntSlice ¶
ConvertStringSliceToIntSlice converts a slice of strings to a slice of ints.
func Map ¶
func Map[T, U any](s []T, f func(T) U) []U
Map applies a function to each element of a slice. ref: https://github.com/sa-/slicefunk/blob/66981647c9612b24c7030d60edcb1215e43c4467/main.go#L3
func MaxFloatSlice ¶
MaxFloatSlice returns the maximum value of a slice of floats.
func MeanFloatSlice ¶
MeanFloatSlice returns the mean of a slice of floats.
func MinFloatSlice ¶
MinFloatSlice returns the minimum value of a slice of floats.
func Unique ¶
func Unique[T comparable](s []T) []T
Unique returns a slice with only unique elements.
Types ¶
type Point2D ¶
type Point2D struct {
X, Y int
}
func (Point2D) EuclideanDistance ¶
func (Point2D) ManhattanDistance ¶
Click to show internal directories.
Click to hide internal directories.