title: Overlapping in treap package from stathat?
body: <p>According to this <a href="https://groups.google.com/forum/?fromgroups=#!topic/golang-nuts/x9bXQ9gKvZg" rel="nofollow">link</a> stathat uses overlapping with their <a href="http://www.stathat.com/src/treap" rel="nofollow">treap</a>:</p>
  
  <blockquote>
    <p>GoLLRB is great and there's no reason you should switch. We thought
    the idea behind treaps was an elegant solution to our problem, so we
    implemented it.  We liked the interface that GoLLRB provided, so we
    mimicked it in our implementation.</p>
    
    <p>One thing we added to the treap package is to allow you to iterate
    using an overlap function, so you can get all the keys in [3,9), for
    example.  We use this a lot, often with a struct as the key.</p>
    
    <p>Patrick</p>
  </blockquote>
  
  <p>I am playing with the following code and have no idea how to continue:</p>
  
  <pre><code>package main
  
  import(
      "reflect"
      "fmt"
      "github.com/stathat/treap"
  )
  
  func IntLess(p, q interface{}) bool {
          return p.(int) &lt; q.(int)
  }
  
  func BucketOverlap(a, b interface{}) bool {
      return false
  }
  
  func main() {
      tree := treap.NewOverlapTree(IntLess, BucketOverlap)
      tree.Insert(5, "a")
      tree.Insert(7, "b")
      tree.Insert(2, "c")
      tree.Insert(1, "d")
  
      for v := range tree.IterateOverlap([]int{2,5}) {
          fmt.Printf("val: %v\n", v)
      }
  }
  </code></pre>
  
  <p>let's say I want to get keys in range <code>[2,5]</code> => <code>[c,a]</code></p>