Documentation
¶
Index ¶
- func All[A any](f F1[A, bool], xs []A) bool
- func And(xs []bool) bool
- func Any[A any](f F1[A, bool], xs []A) bool
- func Append[A any](xs []A, ys []A) []A
- func Break[A any](pred F1[A, bool], xs []A) *Pair[[]A, []A]
- func CartesianProduct[A, B any](xs []A, ys []B) []*Pair[A, B]
- func CartesianProductWith[A, B, C any](f func(A, B) C, xs []A, ys []B) []C
- func ComparatorToLess[A any](comparator Comparator[A]) func(A, A) bool
- func CompareBy[A any](comparisons ...Comparator[A]) Comparator[A]
- func CompareBys[A any](comparisons []Comparator[A]) Comparator[A]
- func CompareIndex[A constraints.Ordered](i int) Comparator[[]A]
- func CompareIndexBy[A any](i int, compare Comparator[A]) Comparator[[]A]
- func CompareIndexOrd[A Ord[A]](i int) Comparator[[]A]
- func ComparePairwise[A constraints.Ordered]() Comparator[[]A]
- func ComparePairwiseBy[A any](compare Comparator[A]) Comparator[[]A]
- func ComparePairwiseOrd[A Ord[A]]() Comparator[[]A]
- func Concat[A any](xss [][]A) []A
- func ConcatMap[A any, B any](f F1[A, []B], xs []A) []B
- func Cons[A any](a A, xs []A) []A
- func Drop[A any](count int, xs []A) []A
- func DropWhile[A any](pred F1[A, bool], xs []A) []A
- func EqualBy[A any](equals ...Equaler[A]) Equaler[A]
- func EqualBys[A any](equals []Equaler[A]) Equaler[A]
- func EqualIndex[A comparable](i int) Equaler[[]A]
- func EqualIndexBy[A any](i int, equal Equaler[A]) Equaler[[]A]
- func EqualIndexEq[A Eq[A]](i int) Equaler[[]A]
- func EqualPairwise[A comparable]() Equaler[[]A]
- func EqualPairwiseBy[A any](equal Equaler[A]) Equaler[[]A]
- func EqualPairwiseEq[A Eq[A]]() Equaler[[]A]
- func Filter[A any](f F1[A, bool], xs []A) []A
- func Find[A any](pred F1[A, bool], xs []A) *maybe.Maybe[A]
- func Foldl[A, B any](combine F2[B, A, B], base B, xs []A) B
- func Foldr[A, B any](combine F2[A, B, B], base B, xs []A) B
- func Group[A comparable](xs []A) map[A][]A
- func GroupConsecutive[A Eq[A]](xs []A) [][]A
- func GroupConsecutiveBy[A any](g F2[A, A, bool], xs []A) [][]A
- func GroupOn[A any, B comparable](projection func(A) B, xs []A) map[B][]A
- func Index[T comparable](s []T, e T) int
- func IndexBy[T any](equal Equaler[T], s []T, e T) int
- func IndexEq[T Eq[T]](s []T, e T) int
- func Insert[A Ord[A]](a A, xs []A) []A
- func Intercalate[A any](sep []A, xss [][]A) []A
- func Intersperse[A any](sep A, xs []A) []A
- func IsPrefixOf[A comparable](xs []A, ys []A) bool
- func IsPrefixOfBy[A any](equal Equaler[A], xs []A, ys []A) bool
- func IsPrefixOfEq[A Eq[A]](xs []A, ys []A) bool
- func Iterate[A any](count int, f F1[A, A], start A) []A
- func Iterator[A any](xs []A) iterable.Iterator[A]
- func Length[A any](xs []A) int
- func Map[A, B any](f F1[A, B], xs []A) []B
- func MapAccumL[A, B, S any](accum F2[S, A, *Pair[S, B]], s S, xs []A) *Pair[S, []B]
- func MapAccumR[A, B, S any](accum F2[S, A, *Pair[S, B]], s S, xs []A) *Pair[S, []B]
- func Maximum[A Ord[A]](xs []A) *maybe.Maybe[A]
- func MaximumBy[A any](f Comparator[A], xs []A) *maybe.Maybe[A]
- func Minimum[A Ord[A]](xs []A) *maybe.Maybe[A]
- func MinimumBy[A any](f Comparator[A], xs []A) *maybe.Maybe[A]
- func Null[A any](xs []A) bool
- func Or(xs []bool) bool
- func Partition[A any](predicate F1[A, bool], xs []A) *Pair[[]A, []A]
- func Product[A builtin.Number](xs []A) A
- func Range[A builtin.Number](start A, stop A, step A) []A
- func Replicate[A any](count int, a A) []A
- func Reverse[A any](xs []A) []A
- func Scanl[A, B any](combine F2[B, A, B], base B, xs []A) []B
- func Scanl1[A any](combine F2[A, A, A], xs []A) []A
- func Scanr[A, B any](combine F2[A, B, B], base B, xs []A) []B
- func Scanr1[A any](combine F2[A, A, A], xs []A) []A
- func Singleton[A any](a A) []A
- func SliceEq[A Eq[A]](a []A) *EqBoxBy[[]A]
- func SliceOrd[A Ord[A]](a []A) *OrdBoxBy[[]A]
- func Sort[A constraints.Ordered](xs []A) []A
- func SortBy[A any](compare Comparator[A], xs []A) []A
- func SortOn[A any, B constraints.Ordered](projection F1[A, B], xs []A) []A
- func SortOnBy[A any, B any](projection F1[A, B], compare Comparator[B], xs []A) []A
- func SortOnOrd[A any, B Ord[B]](projection F1[A, B], xs []A) []A
- func SortOrd[A Ord[A]](xs []A) []A
- func Span[A any](pred F1[A, bool], xs []A) *Pair[[]A, []A]
- func SplitAt[A any](count int, xs []A) *Pair[[]A, []A]
- func Sum[A builtin.Number](xs []A) A
- func Take[A any](count int, xs []A) []A
- func TakeWhile[A any](pred F1[A, bool], xs []A) []A
- func Uncons[A any](xs []A) *maybe.Maybe[*Pair[A, []A]]
- func Unfoldr[A, B any](f F1[B, *maybe.Maybe[*Pair[A, B]]], b B) []A
- func Unzip[A, B any](xs []*Pair[A, B]) *Pair[[]A, []B]
- func Zip[A, B any](xs []A, ys []B) []*Pair[A, B]
- func ZipWith[A, B, C any](f F2[A, B, C], xs []A, ys []B) []C
- type Slice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func All ¶
All is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:all
func And ¶
And is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:and
func Any ¶
Any is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:any
func Append ¶
func Append[A any](xs []A, ys []A) []A
Append is from (++):
https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:-43--43-
func Break ¶
Break is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:break
func CartesianProduct ¶ added in v0.2.0
func CartesianProduct[A, B any](xs []A, ys []B) []*Pair[A, B]
func CartesianProductWith ¶ added in v0.2.0
func CartesianProductWith[A, B, C any](f func(A, B) C, xs []A, ys []B) []C
func ComparatorToLess ¶ added in v0.2.0
ComparatorToLess was useful for working with older versions of the golang.org/x/exp/slices
package, whose sort functions used a different function type for comparison than they currently do. This function probably isn't useful anymore.
func CompareBys ¶
func CompareBys[A any](comparisons []Comparator[A]) Comparator[A]
func CompareIndex ¶ added in v0.2.9
func CompareIndex[A constraints.Ordered](i int) Comparator[[]A]
func CompareIndexBy ¶ added in v0.2.9
CompareIndexBy compares a single index
func CompareIndexOrd ¶ added in v0.2.9
func CompareIndexOrd[A Ord[A]](i int) Comparator[[]A]
func ComparePairwise ¶ added in v0.2.9
func ComparePairwise[A constraints.Ordered]() Comparator[[]A]
func ComparePairwiseBy ¶ added in v0.2.9
func ComparePairwiseBy[A any](compare Comparator[A]) Comparator[[]A]
ComparePairwiseBy should work as in Haskell. Examples from Haskell:
Prelude> [1,2,3] < [3,4,5] True Prelude> [1,2,3] < [3,4] True Prelude> [1,2,3] < [] False
func ComparePairwiseOrd ¶ added in v0.2.9
func ComparePairwiseOrd[A Ord[A]]() Comparator[[]A]
func Concat ¶
func Concat[A any](xss [][]A) []A
Concat is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:concat
func ConcatMap ¶
ConcatMap is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:concatMap
func Cons ¶
func Cons[A any](a A, xs []A) []A
Cons prepends an element to a slice. This implementation may be inefficient.
func Drop ¶
Drop is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:drop
func DropWhile ¶
DropWhile is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:dropWhile
func EqualIndex ¶ added in v0.2.9
func EqualIndex[A comparable](i int) Equaler[[]A]
func EqualIndexBy ¶ added in v0.2.9
EqualIndexBy looks at a single index
func EqualIndexEq ¶ added in v0.2.9
func EqualIndexEq[A Eq[A]](i int) Equaler[[]A]
func EqualPairwise ¶ added in v0.2.9
func EqualPairwise[A comparable]() Equaler[[]A]
func EqualPairwiseBy ¶ added in v0.2.9
func EqualPairwiseBy[A any](equal Equaler[A]) Equaler[[]A]
func EqualPairwiseEq ¶ added in v0.2.9
func EqualPairwiseEq[A Eq[A]]() Equaler[[]A]
func Filter ¶
Filter is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:filter
func Find ¶
Find is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:find
func Foldl ¶
func Foldl[A, B any](combine F2[B, A, B], base B, xs []A) B
Foldl is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:foldl
foldl f z [x1, x2, ..., xn] == (...((z `f` x1) `f` x2) `f`...) `f` xn
func Foldr ¶
func Foldr[A, B any](combine F2[A, B, B], base B, xs []A) B
Foldr is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:foldr
foldr f z [x1, x2, ..., xn] == x1 `f` (x2 `f` ... (xn `f` z)...)
func Group ¶
func Group[A comparable](xs []A) map[A][]A
func GroupConsecutive ¶
func GroupConsecutive[A Eq[A]](xs []A) [][]A
GroupConsecutive is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:group
func GroupConsecutiveBy ¶
GroupConsecutiveBy is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:groupBy
func GroupOn ¶
func GroupOn[A any, B comparable](projection func(A) B, xs []A) map[B][]A
func Index ¶
func Index[T comparable](s []T, e T) int
func Insert ¶
func Insert[A Ord[A]](a A, xs []A) []A
Insert is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:insert
func Intercalate ¶
func Intercalate[A any](sep []A, xss [][]A) []A
Intercalate is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:intercalate
func Intersperse ¶
func Intersperse[A any](sep A, xs []A) []A
Intersperse is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:intersperse
func IsPrefixOf ¶ added in v0.2.0
func IsPrefixOf[A comparable](xs []A, ys []A) bool
func IsPrefixOfBy ¶ added in v0.2.0
func IsPrefixOfEq ¶ added in v0.2.0
func IsPrefixOfEq[A Eq[A]](xs []A, ys []A) bool
func Iterate ¶
Iterate is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:iterate
it uses a count to avoid an infinite slice
func Length ¶
Length is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:length
func Map ¶
func Map[A, B any](f F1[A, B], xs []A) []B
Map is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:map
func MapAccumL ¶
func MapAccumL[A, B, S any](accum F2[S, A, *Pair[S, B]], s S, xs []A) *Pair[S, []B]
MapAccumL is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:mapAccumL
forall t s a b. Traversable t => (s -> a -> (s, b)) -> s -> t a -> (s, t b)
func MapAccumR ¶
func MapAccumR[A, B, S any](accum F2[S, A, *Pair[S, B]], s S, xs []A) *Pair[S, []B]
MapAccumR is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:mapAccumR
forall t s a b. Traversable t => (s -> a -> (s, b)) -> s -> t a -> (s, t b)
func Maximum ¶
Maximum is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:maximum
since Haskell's maximum blows up on empty lists, this has been modified for safety
func MaximumBy ¶
MaximumBy is from https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:maximumBy
func Minimum ¶
Minimum is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:minimum
since Haskell's minimum blows up on empty lists, this has been modified for safety
func MinimumBy ¶
MinimumBy is from https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:minimumBy
func Null ¶
Null is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:null
func Partition ¶
Partition is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:partition
func Product ¶
Product is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:product
func Replicate ¶
Replicate is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:replicate
func Reverse ¶
func Reverse[A any](xs []A) []A
Reverse is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:reverse
func Scanl ¶
func Scanl[A, B any](combine F2[B, A, B], base B, xs []A) []B
Scanl is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:scanl
func Scanl1 ¶
func Scanl1[A any](combine F2[A, A, A], xs []A) []A
Scanl1 is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:scanl1
func Scanr ¶
func Scanr[A, B any](combine F2[A, B, B], base B, xs []A) []B
Scanr is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:scanr
func Scanr1 ¶
func Scanr1[A any](combine F2[A, A, A], xs []A) []A
Scanr1 is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:scanr1
func Singleton ¶
func Singleton[A any](a A) []A
Singleton is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:singleton
func Sort ¶
func Sort[A constraints.Ordered](xs []A) []A
Sort is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:sort
It orders elements by their natural Ord instance.
func SortBy ¶
func SortBy[A any](compare Comparator[A], xs []A) []A
SortBy is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:sortBy
It allows sorting based on a custom comparison operator; therefore it does not require input elements to have an Ord instance.
func SortOn ¶
func SortOn[A any, B constraints.Ordered](projection F1[A, B], xs []A) []A
SortOn is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:sortOn
It uses the decorate/sort/undecorate pattern. It allows a projection of each element to be used to determine the order. The projection must be Ordered.
func SortOnBy ¶
SortOnBy combines the functionality of `SortOn` and `SortBy`,
thereby separating projection and comparison functions
func Span ¶
Span is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:span
func SplitAt ¶
SplitAt is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:splitAt
func Sum ¶
Sum is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:sum
func Take ¶
Take is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:take
func TakeWhile ¶
TakeWhile is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:takeWhile
func Uncons ¶
Uncons is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:uncons
func Unfoldr ¶
Unfoldr is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:unfoldr
func Unzip ¶
func Unzip[A, B any](xs []*Pair[A, B]) *Pair[[]A, []B]
Unzip is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:unzip
func Zip ¶
func Zip[A, B any](xs []A, ys []B) []*Pair[A, B]
Zip is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:zip
func ZipWith ¶
func ZipWith[A, B, C any](f F2[A, B, C], xs []A, ys []B) []C
ZipWith is from: https://hackage.haskell.org/package/base-4.16.2.0/docs/Data-List.html#v:zipWith