code: func compareSegmentType(a, b segment) int {
  	segs := []segment{a, b}
  	ranks := make([]int, 2)
  	for i, seg := range segs {
  		switch seg.(type) {
  		case literal:
  			ranks[i] = 3
  		case glob:
  			ranks[i] = 2
  		case alternation:
  			ranks[i] = 1
  		case fullglob:
  			ranks[i] = 0
  		default:
  			panic("Bad type for segment!")
  		}
  	}
  
  	switch {
  	case ranks[0] < ranks[1]:
  		return -1
  	case ranks[0] > ranks[1]:
  		return 1
  	default:
  		return 0
  	}
  }
docs: // compareSegmentType ranks the segments by their type specificity