Documentation
¶
Index ¶
- Constants
- func AbsInt(a int) int
- func ConstIntFunc(x int) func(int) int
- func IdentIntFunc(i int) int
- func IntsEq(a, b []int) bool
- func IntsHas(a []int, n int) bool
- func IntsSum(a []int) (sum int)
- func LoadFile(fname string) (data string)
- func LoadTwoStringsFromFile(fname string) (string, string)
- func MaxInt(ints ...int) (m int)
- func MaxIntIndex(ints ...int) (i int)
- func MinInt(ints ...int) (m int)
- func MinIntIndex(ints ...int) (i int)
- func MultIntFunc(x int) func(int) int
- func NewInts(size int, opts ...int) (out []int)
- func ParseFloat(str string, opts ...int) (f float64)
- func ParseInt(str string, opts ...int) (i int)
- type BitArray
- type FileHashes
Constants ¶
const Inf = int(MaxUint >> 1)
Inf = Plus Infinity
const MaxUint = ^uint(0)
MaxUint = Plus Infinity (unsigned)
const MinInf = -(Inf - 1)
MinInf = Minus Infinity
const MinUint = 0
MinUint = Minus Infinity (unsigned)
Variables ¶
This section is empty.
Functions ¶
func LoadFile ¶
LoadFile loads a file and returns it as a string, handling reading errors internally
func LoadTwoStringsFromFile ¶
LoadTwoStringsFromFile loads the first two strings (separated by \n) from a file NOTE: Inefficient when you have (much) more than just two strings in a file.
func MaxIntIndex ¶
MaxIntIndex returns the index corresponding to the maximum int
func MinIntIndex ¶
MinIntIndex returns the index corresponding to the minimum int
func MultIntFunc ¶
MultIntFunc returns a constant multiplier function
func ParseFloat ¶
ParseFloat converts a float from a string representation to an actual float
Types ¶
type BitArray ¶
type BitArray struct {
// contains filtered or unexported fields
}
func NewBitArray ¶
type FileHashes ¶
FileHashes holds a map between file paths and their hashes
func FileHashesNew ¶
func FileHashesNew(root string) (hashes FileHashes)
FileHashesNew walks all the folders/files starting at "root".
func (FileHashes) Diff ¶
func (fh FileHashes) Diff(other FileHashes) (diff []string)
Diff computes the difference between two file hashes/maps.
func (FileHashes) Dump ¶
func (fh FileHashes) Dump(fname string) (e error)
Dump writes file hashes to disk.
func (FileHashes) Filter ¶
func (fh FileHashes) Filter(fnames []string) (out FileHashes)
Filter keeps only those FileHashes that are in fnames list.
func (FileHashes) Reject ¶
func (fh FileHashes) Reject(fnames []string) (out FileHashes)
Reject returns all the FileHashes that are NOT in the fnames list.