mirror of
https://github.com/samber/lo.git
synced 2026-04-22 23:47:11 +08:00
fa095e4b4f
* fix(doc): fix go playground demo URL * fix(doc): add more go playground demo URL
626 B
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 |
|
https://go.dev/play/p/o-BD4UOn-0U |
|
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