Documentation
¶
Index ¶
- func CacheCallback[F ~func(A) T, KF func(A) K, C ~func(K, func() func() T) func() T, A any, ...](kf KF, getOrCreate C) func(F) F
- func ContramapMemoize[F ~func(A) T, KF func(A) K, A any, K comparable, T any](kf KF) func(F) F
- func Memoize[F ~func(K) T, K comparable, T any](f F) F
- func Switch[HF ~func(T) R, N ~map[K]HF, KF ~func(T) K, K comparable, T, R any](kf KF, n N, d HF) HF
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CacheCallback ¶
func CacheCallback[F ~func(A) T, KF func(A) K, C ~func(K, func() func() T) func() T, A any, K comparable, T any](kf KF, getOrCreate C) func(F) F
CacheCallback converts a unary function into a unary function that caches the value depending on the parameter
func ContramapMemoize ¶ added in v1.0.27
func ContramapMemoize[F ~func(A) T, KF func(A) K, A any, K comparable, T any](kf KF) func(F) F
ContramapMemoize converts a unary function into a unary function that caches the value depending on the parameter
func Memoize ¶ added in v1.0.27
func Memoize[F ~func(K) T, K comparable, T any](f F) F
Memoize converts a unary function into a unary function that caches the value depending on the parameter
func Switch ¶ added in v1.0.58
func Switch[HF ~func(T) R, N ~map[K]HF, KF ~func(T) K, K comparable, T, R any](kf KF, n N, d HF) HF
Switch applies a handler to different cases. The handers are stored in a map. A key function extracts the case from a value.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.