generic

package
v1.0.153 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheCallback

func CacheCallback[
	EM ~func(F) F,
	LLT ~func() LT,
	LT ~func() T,
	F ~func(A) T,
	KF func(A) K,
	C ~func(K, LLT) LT,
	A any, K comparable, T any](kf KF, getOrCreate C) EM

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 SingleElementCache added in v1.0.85

func SingleElementCache[
	LLT ~func() LT,
	K comparable,
	LT ~func() T,
	T any,
]() func(K, LLT) LT

SingleElementCache is a cache with a capacity of a single element

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.

Jump to

Keyboard shortcuts

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

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy