aoc

package module
v0.0.0-...-816c0c8 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AtoiOrBust

func AtoiOrBust(s string) int

AtoiOrBust converts a string to an integer, or it panics

func FileInts

func FileInts(p string) (ints []int)

FileInts reads all the lines of a file, parses them into ints and returns them as a slice

func FileLines

func FileLines(p string) (lines []string)

FileLines returns all the lines in a file in a slice

func PrintDuration

func PrintDuration(t time.Time)

PrintDuration prints the time since t. Call this function like this and it will print the run time of a function after it ends:

defer aoc.PrintDuration(time.Now())

This works because when you use 'defer' the arguments of a function will be evaluated immediately, while the function itself will only be evaluated after the parent function ends.

Types

type ScannerCloser

type ScannerCloser struct {
	*bufio.Scanner
	io.Closer
}

ScannerCloser is a scanner with a Close method to close the underlying file

func FileScanner

func FileScanner(p string) ScannerCloser

FileScanner opens a file and wraps it in a scanner. Close the file after you are done with the returned io.Closer

Directories

Path Synopsis
2018
2020
2023
01

Jump to

Keyboard shortcuts

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