Files
lo/docs/data/it-issorted.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
IsSorted issorted it/seq.go#L720 it slice
func IsSorted[T constraints.Ordered](collection iter.Seq[T]) bool
https://go.dev/play/p/o-BD4UOn-0U
core#slice#issorted
200

IsSorted checks if a sequence is sorted.

sorted := func(yield func(int) bool) {
    yield(1)
    yield(2)
    yield(3)
    yield(4)
}
unsorted := func(yield func(int) bool) {
    yield(1)
    yield(3)
    yield(2)
    yield(4)
}

fmt.Println(it.IsSorted(sorted))    // true
fmt.Println(it.IsSorted(unsorted))  // false