Files
lo/docs/data/it-reverse.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

693 B

name, slug, sourceRef, category, subCategory, signatures, playUrl, variantHelpers, similarHelpers, position
name slug sourceRef category subCategory signatures playUrl variantHelpers similarHelpers position
Reverse reverse it/seq.go#L366 it sequence
func Reverse[T any, I ~func(func(T) bool)](collection I) I
https://go.dev/play/p/R6-lR8yiNwa
it#sequence#reverse
core#slice#reverse
it#sequence#shuffle
90

Reverses a sequence so the first element becomes the last and the last element becomes the first.

Examples:

seq := func(yield func(int) bool) {
    _ = yield(1)
    _ = yield(2)
    _ = yield(3)
    _ = yield(4)
}
reversed := it.Reverse(seq)
var result []int
for v := range reversed {
    result = append(result, v)
}
// result contains 4, 3, 2, 1