internal/stack/stack.go
func (s *Stack) Set(i int, v interface{}) error {
	if i < 0 {
		return errors.New("invalid index into stack")
	}

	if i >= s.BufferSize() {
		s.Resize(calcNewSize(i))
	}

	for len(*s) < i + 1 {
		*s = append(*s, nil)
	}

	(*s)[i] = v
	return nil
}
func (s *Stack) Set(i int, v interface{}) error {
	if i < 0 {
		return errors.New("invalid index into stack")
	}

	if i >= s.BufferSize() {
		s.Resize(calcNewSize(i))
	}

	for len(*s) < i + 1 {
		*s = append(*s, nil)
	}

	(*s)[i] = v
	return nil
}
// Set sets the element at position `i` to `v`. The stack size is automatically
// adjusted.