Documentation
¶
Overview ¶
Package funky provides a few constructs usually present in pure functional programming environments, using Go 1.18 generics.
Index ¶
- func MapSlice[V, W any](in slice[V], f func(V) W) slice[W]
- func Mapping[K comparable, V any](m map[K]V) mapping[K, V]
- func MappingFromSlice[K comparable, V any](sl slice[MapItem[K, V]]) mapping[K, V]
- func Slice[V any](sl []V) slice[V]
- func SliceIterator[V any](sl slice[V]) *sliceIterator[V]
- func ToSlice[V any](it Iterator[V]) slice[V]
- func Walk[V any](it Iterator[V], f func(V))
- type Either
- type Iterable
- type Iterator
- type Map
- type MapItem
- type Maybe
- type Sizeable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Mapping ¶
func Mapping[K comparable, V any](m map[K]V) mapping[K, V]
func MappingFromSlice ¶
func MappingFromSlice[K comparable, V any](sl slice[MapItem[K, V]]) mapping[K, V]
func SliceIterator ¶
func SliceIterator[V any](sl slice[V]) *sliceIterator[V]
Types ¶
type Either ¶
An Either item has either a Left value (signifying some special condition like an error) or a Right (real) one. It also provides the Maybe interface, interpreting a Left value as Nothing.
type Iterator ¶
func MapIterator ¶
func MappingIterator ¶
func MappingIterator[K comparable, V any](m mapping[K, V]) Iterator[MapItem[K, V]]
type Map ¶
type Map[K comparable, V any] interface { Iterable[MapItem[K, V]] Maybe[MapItem[K, V]] Sizeable Get(K) Maybe[V] Set(K, V) Delete(K) Keys() Iterator[K] Values() Iterator[V] }
func MapMapping ¶
func MapMapping[K comparable, V, W any](in Map[K, V], f func(V) W) Map[K, W]
type MapItem ¶
type MapItem[K comparable, V any] struct { Key K Value V }
Click to show internal directories.
Click to hide internal directories.