lazy_memo library

Provides helper classes for the creation of lazy variables and memoized functions.

Classes

Lazy<T>
A class that caches an object of type T. The cache is populated when the object is first accessed.
LazyList<T>
A lazy variable that caches a list with entries of type T.
LazyMap<K, V>
A lazy variable that caches a map of type Map<K, V>.
LazySet<T>
A lazy variable that caches a set with entries of type T.
MemoizedFunction<A, T>
Class representing a memoized function requiring a single argument of type A and returning an object of type T.
MemoizedFunction2<A1, A2, T>
Class representing a memoized function requiring arguments of type A1 and A2, respectively, and returning an object of type T.

Extensions

ToBigInt on int

Properties

combinations MemoizedFunction2<BigInt, BigInt, BigInt>
Returns the number of k-combinations of n distinct objects. More formally, let S be a set containing n distinct objects. Then the number of subsets containing k objects is given by combinations(n, k).
final
factorial MemoizedFunction<BigInt, BigInt>
Returns the factorial of a positive integer. Throws and error of type ArgumentError if a negative argument is provided.
final

Typedefs

DoubleArgumentFunction<A1, A2, T> = T Function(A1 arg1, A2 arg2)
A function requiring arguments of type A1, A2 and returning an object of type T.
ObjectFactory<T> = T Function()
Callback used to lazily create an object of type T.
SingleArgumentFunction<A, T> = T Function(A arg)
A function requiring a single argument of type A and returning an object of type T.