code: func (r *RecordList) Remove(ev EventBuilder, fn Listener) int {
  	idx, rec := r.Find(ev.Name())
  	if idx == -1 {
  		return 0
  	}
  
  	// 1. Find the index of the listener in the list
  	oldList := rec.getUnsafeList()
  	spliceIndex := -1
  	for i, l := range oldList {
  		if l != nil && (*(*Listener)(l)) == fn {
  			spliceIndex = i
  			break
  		}
  	}
  
  	if spliceIndex == -1 {
  		return len(oldList)
  	}
  
  	newCount := len(oldList) - rec.inactiveItems - 1
  	// 2. If that's the only listener, just remove that record entirely.
  	if newCount == 0 {
  		r.remove(idx)
  		return 0
  	}
  
  	// 3. Otherwise, wipe the pointer, or make a new list copied from the parts
  	// of the old if we wanted to compact it.
  	if float32(rec.inactiveItems+1)/float32(len(oldList)) < compactionThreshold {
  		rec.storeAtIndex(spliceIndex, nil)
  		rec.inactiveItems++
  		return newCount
  	}
  
  	newList := make([]unsafe.Pointer, 0, newCount)
  	for i, ptr := range oldList {
  		if ptr != nil && i != spliceIndex {
  			newList = append(newList, ptr)
  		}
  	}
  	rec.inactiveItems = 0
  	rec.setList(newList)
  
  	return newCount
  }
docs: // Remove delete the listener from the event. Returns the event's remaining
  // listeners. Not thread-safe with other write operations.