mirror of
https://github.com/samber/lo.git
synced 2026-04-22 23:47:11 +08:00
583 B
583 B
name, slug, sourceRef, category, subCategory, signatures, variantHelpers, similarHelpers, position
| name | slug | sourceRef | category | subCategory | signatures | variantHelpers | similarHelpers | position | ||
|---|---|---|---|---|---|---|---|---|---|---|
| IsSorted | issorted | it/seq.go#L720 | it | slice |
|
|
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