Documentation ¶
Index ¶
- func Abundant[K constraints.Integer](n K) bool
- func All[K comparable](vs []K, f func(K) bool) bool
- func Any[K comparable](vs []K, f func(K) bool) bool
- func Deficient[K constraints.Integer](n K) bool
- func Divisors[K constraints.Integer](n K) (divisors []K)
- func EditDistance1(s, t string) int
- func EditDistance2(s, t string) int
- func Filter[K comparable](vs []K, f func(K) bool) []K
- func HexStringToBase64String(hexstring string) (string, error)
- func HexToBase64(hexbytes []byte) ([]byte, error)
- func Include[K comparable](vs []K, t K) bool
- func Index[K comparable](vs []K, t K) int
- func IsPalindrome(s string) bool
- func IsPrime[K constraints.Integer](n K) bool
- func LevenschteinCost(m matrix, i, j, cost int) int
- func Map[K comparable](vs []K, f func(K) K) []K
- func Perfect[K constraints.Integer](n K) bool
- func PrimeSieve[K constraints.Integer](max K) []K
- func SmithWatermanCost(m matrix, i, j, cost int) int
- func SqrtInt[K constraints.Integer](x K) K
- func Sum[K constraints.Integer](vals ...K) (sum K)
- func XORBytes(a, b []byte) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Abundant ¶
func Abundant[K constraints.Integer](n K) bool
Abundant checks if n is an abundant integer. An integer is abundant if the sum of its proper divisors is more than the integer.
func All ¶
func All[K comparable](vs []K, f func(K) bool) bool
All returns `true` if all of the Ks in the slice satisfy the predicate `f`.
func Any ¶
func Any[K comparable](vs []K, f func(K) bool) bool
Any returns `true` if one of the Ks in the slice satisfies the predicate `f`.
func Deficient ¶
func Deficient[K constraints.Integer](n K) bool
Deficient checks if n is a deficient integer. An integer is deficient if the sum of its proper divisors is less than the integer.
func Divisors ¶
func Divisors[K constraints.Integer](n K) (divisors []K)
Divisors returns an integer slice of the proper divisors of n.
func EditDistance1 ¶
EditDistance1 calculates the edit (or Levenschtein) distance between two strings by creating an entire backtraceable matrix.
func EditDistance2 ¶
EditDistance2 calculates the edit (or Levenschtein) distance between two strings by just using the previous row and the previous values in the current row. This saves memory, but requires copying rows forward.
func Filter ¶
func Filter[K comparable](vs []K, f func(K) bool) []K
Filter returns a new slice containing all Ks in the slice that satisfy the predicate `f`.
func HexStringToBase64String ¶
HexStringToBase64String converts a hexadecimal-encoded string to a base64-encoded string.
func HexToBase64 ¶
HexToBase64 converts a slice of hexadecimal bytes to the equivalent base64 slice of bytes.
func Include ¶
func Include[K comparable](vs []K, t K) bool
Include returns `true` if the target string t is in the slice.
func Index ¶
func Index[K comparable](vs []K, t K) int
Index returns the first index of the target string `t`, or -1 if no match is found.
func LevenschteinCost ¶
LevenschteinCost is used for best global alignment.
func Map ¶
func Map[K comparable](vs []K, f func(K) K) []K
Map returns a new slice containing the results of applying the function `f` to each K in the original slice.
func Perfect ¶
func Perfect[K constraints.Integer](n K) bool
Perfect checks if n is a perfect integer. An integer is perfect if the sum of its proper divisors is equal to the integer.
func PrimeSieve ¶
func PrimeSieve[K constraints.Integer](max K) []K
PrimeSieve implements the Sieve of Eratosthenes.
func SmithWatermanCost ¶
SmithWatermanCost is used for best local alignment.
func SqrtInt ¶
func SqrtInt[K constraints.Integer](x K) K
SqrtInt determines the square root of an int.
Types ¶
This section is empty.