Files
lo/docs/data/it-issortedby.md
T
Samuel Berthe fa095e4b4f fix(doc): fix go playground demo URL (#832)
* fix(doc): fix go playground demo URL

* fix(doc): add more go playground demo URL
2026-03-06 00:09:59 +01:00

626 B

name, slug, sourceRef, category, subCategory, signatures, playUrl, variantHelpers, similarHelpers, position
name slug sourceRef category subCategory signatures playUrl variantHelpers similarHelpers position
IsSortedBy issortedby it/seq.go#L720 it slice
func IsSortedBy[T any, K constraints.Ordered](collection iter.Seq[T], transform func(item T) K) bool
https://go.dev/play/p/AfYOiGWa78T
core#slice#issortedby
201

IsSortedBy checks if a sequence is sorted by transform.

collection := func(yield func(string) bool) {
    yield("apple")
    yield("banana")
    yield("cherry")
}

sortedByLength := it.IsSortedBy(collection, func(s string) int {
    return len(s)
})
// true (5, 6, 6 is sorted)