7 func min(i Int, rest ...Int) Int {
9 for _, i := range rest {
21 func (e Extent) End() Int {
22 return e.Start + e.Length
26 Callback = func(int, Extent) bool
27 LengthIter = func() (Length, bool)
30 func Scan(haystack LengthIter, needle Extent, callback Callback) bool {
32 for needle.Length != 0 {
37 if needle.Start < l || needle.Start == l && l == 0 {
40 Length: min(l, needle.End()) - needle.Start,
47 needle.Length -= e1.Length
57 func LocaterFromLengthIter(li LengthIter) Locater {
58 return func(e Extent, c Callback) bool {
63 type Locater func(Extent, Callback) bool