diff --git a/core/iterable/iterable.go b/core/iterable/iterable.go index d413d90..b7fb165 100644 --- a/core/iterable/iterable.go +++ b/core/iterable/iterable.go @@ -26,8 +26,9 @@ func From[T any](slice []T) Iterator[T] { i := 0 return NewIterator(func() (T, error) { if i < len(slice) { + item := slice[i] i++ - return slice[i], nil + return item, nil } var undef T return undef, io.EOF