You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: slice.go
    path of file: ./repos/ferret/pkg/runtime/collections
    
    the code of the file until where you have to start completion: package collections

import (
	"context"

	"github.com/MontFerret/ferret/pkg/runtime/core"
	"github.com/MontFerret/ferret/pkg/runtime/values"
)

type SliceIterator struct {
	valVar string
	keyVar string
	values []core.Value
	pos    int
}

func NewSliceIterator(
	valVar,
	keyVar string,
	values []core.Value,
) (Iterator, error) {
	if values == nil {
		return nil, core.Error(core.ErrMissedArgument, "result")
	}

	return &SliceIterator{valVar, keyVar, values, 0}, nil
}

func NewDefaultSliceIterator(i
    
func (iterator *SliceIterator) Next(_ context.Context, scope *core.Scope) (*core.Scope, error) {
	if len(iterator.values) > iterator.pos {
		idx := iterator.pos
		val := iterator.values[idx]

		iterator.pos++

		nextScope := scope.Fork()

		if err := nextScope.SetVariable(iterator.valVar, val); err != nil {
			return nil, err
		}

		if iterator.keyVar != "" {
			if err := nextScope.SetVariable(iterator.keyVar, values.NewInt(idx)); err != nil {
				return nil, err
			}
		}

		return nextScope, nil
	}

	return nil, core.ErrNoMoreData
}