func IndexOfPath(paths []Path, p Path) int {
	for i, x := range paths {
		if p.Equal(x) {
			return i
		}
	}
	return -1
}
IndexOfPath returns the index of the path within the slice of paths, or -1 if the path
isn't present.
package index
import (
	"fmt"
	"sort"
	"strconv"
	"strings"
)
const PathSeparator string = ":"
type Key string
func (k Key) String() string {
	return string(k)
}
type Path []Key
func (p Path) String() string {
	return p.Encode()
}
func (p Path) Encode() string {
	l := make([]string, len(p))
	for i, k := range p {
		l[i] = string(k)
	}
	return strings.Join(l, PathSeparator)
}
func (p Path) Equal(q Path) bool {
	if len(p) != len(q) {
		return false
	}
	for i, x := range p {
		if x != q[i] {
			return false
		}
	}
	return true
}
func (p Path) Contains(q Path) bool {
	if len(p) == 0 || len(p) > len(q) {
		return false
	}
	for i, x := range p {
		if q[i] != x {
			return false
		}
	}
	return true
}