// AppendSlice appends values to the given slice.
186701
func (r *RedisStore) AppendSlice(key string, values ...interface{}) error {
	return r.SetSlice(key, values)
}
1184298
func BytesSlice(val, sep string) ([][]byte, error) {
	s := strings.Split(val, sep)
	values := make([][]byte, len(s))
	for i, v := range s {
		value, err := Bytes(v)
		if err != nil {
			return values, err
		}
		values[i] = value
	}
	return values, nil
}
365179
func Uint32Slice(src []uint32) []*uint32 {
	dst := make([]*uint32, len(src))
	for i := 0; i < len(src); i++ {
		dst[i] = &(src[i])
	}
	return dst
}
527830
func CopyAppend(slice []interface{}, elements ...interface{}) []interface{} {
	sliceLength := len(slice)
	newSlice := make([]interface{}, sliceLength+len(elements))
	for i, e := range slice {
		newSlice[i] = e
	}
	for i, e := range elements {
		newSlice[sliceLength+i] = e
	}
	return newSlice
}
108595
func (tb *LTable) Append(value LValue) {
	if value == LNil {
		return
	}
	if tb.array == nil {
		tb.array = make([]LValue, 0, defaultArrayCap)
	}
	tb.array = append(tb.array, value)
}
803043
func DirSlice(t *testing.T, path string) []Case {
	sl := []Case{}
	for c := range Dir(t, path) {
		sl = append(sl, c)
	}
	return sl
}
1280801
func MergeSlices(args ...[]string) []string {
	all := map[string]struct{}{}
	for _, slice := range args {
		for _, v := range slice {
			all[v] = struct{}{}
		}
	}

	result := make([]string, 0, len(all))
	for k := range all {
		result = append(result, k)
	}
	sort.Strings(result)
	return result
}
78726
func SumIntSlice(slice []int) int {
	sum := 0
	for _, val := range slice {
		sum += val
	}
	return sum
}
1223232
func (c *Context) IntSlice(name string) []int {
	return lookupIntSlice(name, c.flagSet)
}
300789
func (m PinMap) ToSlice() PinSlice {
	s := make(PinSlice, 0, len(m))
	pkgs := make(sort.StringSlice, 0, len(m))
	for k := range m {
		pkgs = append(pkgs, k)
	}
	pkgs.Sort()
	for _, pkg := range pkgs {
		s = append(s, Pin{pkg, m[pkg]})
	}
	return s
}
344646
func (mmap MarshalMap) Int64Slice(key string) ([]int64, error) {
	return mmap.Int64Array(key)
}
1101840
func (p uint64Slice) merge(other []uint64) []uint64 {
	ret := make([]uint64, 0, len(p))

	i, j := 0, 0
	for i < len(p) && j < len(other) {
		a, b := p[i], other[j]
		if a == b {
			ret = append(ret, a)
			i, j = i+1, j+1
		} else if a < b {
			ret = append(ret, a)
			i++
		} else {
			ret = append(ret, b)
			j++
		}
	}

	if i < len(p) {
		ret = append(ret, p[i:]...)
	} else if j < len(other) {
		ret = append(ret, other[j:]...)
	}

	return ret
}
1057487
func (e *Encoder) marshalSlice(val reflect.Value, child bool) (string, bool) {
	var ok bool
	if ok = supportedBaseKind(val); !ok {
		return "", false
	}
	var sl, str string
	// check the type of slice and handle
	for j := 0; j < val.Len(); j++ {
		str = ""
		str, ok = e.stringify(val.Index(j), child)
		if !ok {
			return "", false
		}
		if j == 0 {
			sl = str
			continue
		}
		sl = fmt.Sprintf("%s,%s", sl, str)
	}
	if child {
		sl = fmt.Sprintf("%s%s%s", e.sepBeg, sl, e.sepEnd)
	}
	return sl, true
}
970968
func mergeSlice(m1, m2 []merger) []merger {
	r := make([]merger, len(m1), len(m1)+len(m2))
	copy(r, m1)

	m := map[string]struct{}{}
	for _, v2 := range m2 {
		// If we already saw it, just append it because its a
		// duplicate and invalid...
		name := v2.mergerName()
		if _, ok := m[name]; ok {
			r = append(r, v2)
			continue
		}
		m[name] = struct{}{}

		// Find an original to override
		var original merger
		originalIndex := -1
		for i, v := range m1 {
			if v.mergerName() == name {
				originalIndex = i
				original = v
				break
			}
		}

		var v merger
		if original == nil {
			v = v2
		} else {
			v = original.mergerMerge(v2)
		}

		if originalIndex == -1 {
			r = append(r, v)
		} else {
			r[originalIndex] = v
		}
	}

	return r
}
1354733
func Uint32Slice(val, sep string) ([]uint32, error) {
	s := strings.Split(val, sep)
	values := make([]uint32, len(s))
	for i, v := range s {
		value, err := Uint32(v)
		if err != nil {
			return values, err
		}
		values[i] = value
	}
	return values, nil
}
905142
func Append(to interface{}, from ...interface{}) (interface{}, error) {
	tov, toIsNil := indirect(reflect.ValueOf(to))

	toIsNil = toIsNil || to == nil
	var tot reflect.Type

	if !toIsNil {
		if tov.Kind() != reflect.Slice {
			return nil, fmt.Errorf("expected a slice, got %T", to)
		}

		tot = tov.Type().Elem()
		toIsNil = tov.Len() == 0

		if len(from) == 1 {
			fromv := reflect.ValueOf(from[0])
			if fromv.Kind() == reflect.Slice {
				if toIsNil {
					// If we get nil []string, we just return the []string
					return from[0], nil
				}

				fromt := reflect.TypeOf(from[0]).Elem()

				// If we get []string []string, we append the from slice to to
				if tot == fromt {
					return reflect.AppendSlice(tov, fromv).Interface(), nil
				} else if !fromt.AssignableTo(tot) {
					// Fall back to a []interface{} slice.
					return appendToInterfaceSliceFromValues(tov, fromv)

				}
			}
		}
	}

	if toIsNil {
		return Slice(from...), nil
	}

	for _, f := range from {
		fv := reflect.ValueOf(f)
		if !fv.Type().AssignableTo(tot) {
			// Fall back to a []interface{} slice.
			return appendToInterfaceSlice(tov, from...)
		}
		tov = reflect.Append(tov, fv)
	}

	return tov.Interface(), nil
}
794274
func IntSlice(src []int) []*int {
	dst := make([]*int, len(src))
	for i := 0; i < len(src); i++ {
		dst[i] = &(src[i])
	}
	return dst
}