Skip to content

Commit b0927fd

Browse files
callthingsoffgopherbot
authored andcommitted
slices: update docs for All, Backward, Values
For #61899 Change-Id: I3586b9b59e87159d21e1a270dabb3af213592739 Reviewed-on: https://go-review.googlesource.com/c/go/+/595515 Auto-Submit: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
1 parent 5a18e79 commit b0927fd

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/slices/iter.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import (
99
"iter"
1010
)
1111

12-
// All returns an iterator over index-value pairs in the slice.
13-
// The indexes range in the usual order, from 0 through len(s)-1.
12+
// All returns an iterator over index-value pairs in the slice
13+
// in the usual order.
1414
func All[Slice ~[]E, E any](s Slice) iter.Seq2[int, E] {
1515
return func(yield func(int, E) bool) {
1616
for i, v := range s {
@@ -22,7 +22,7 @@ func All[Slice ~[]E, E any](s Slice) iter.Seq2[int, E] {
2222
}
2323

2424
// Backward returns an iterator over index-value pairs in the slice,
25-
// traversing it backward. The indexes range from len(s)-1 down to 0.
25+
// traversing it backward with descending indices.
2626
func Backward[Slice ~[]E, E any](s Slice) iter.Seq2[int, E] {
2727
return func(yield func(int, E) bool) {
2828
for i := len(s) - 1; i >= 0; i-- {
@@ -33,8 +33,7 @@ func Backward[Slice ~[]E, E any](s Slice) iter.Seq2[int, E] {
3333
}
3434
}
3535

36-
// Values returns an iterator over the slice elements,
37-
// starting with s[0].
36+
// Values returns an iterator that yields the slice elements in order.
3837
func Values[Slice ~[]E, E any](s Slice) iter.Seq[E] {
3938
return func(yield func(E) bool) {
4039
for _, v := range s {

0 commit comments

Comments
 (0)