query.go
func (iter Enumerator) splitN(operation Transform, n uint) []Enumerator {
	results, cast := make([]chan interface{}, n, n), make([]Enumerator, n, n)

	for i := uint(0); i < n; i++ {
		results[i] = make(chan interface{})
		cast[i] = results[i]
	}

	go func() {
		for i := uint(0); i < n; i++ {
			go func(addr uint) {
				defer close(results[addr])
				for {
					read, ok := <-iter
					if !ok {
						return
					}
					results[addr] <- operation(read)
				}
			}(i)
		}
	}()

	return cast
}
func (iter Enumerator) splitN(operation Transform, n uint) []Enumerator {
	results, cast := make([]chan interface{}, n, n), make([]Enumerator, n, n)

	for i := uint(0); i < n; i++ {
		results[i] = make(chan interface{})
		cast[i] = results[i]
	}

	go func() {
		for i := uint(0); i < n; i++ {
			go func(addr uint) {
				defer close(results[addr])
				for {
					read, ok := <-iter
					if !ok {
						return
					}
					results[addr] <- operation(read)
				}
			}(i)
		}
	}()

	return cast
}
func ( iter Enumerator ) splitN ( operation Transform , n uint ) [ ] Enumerator { results , cast := make ( [ ] chan interface { } , n , n ) , make ( [ ] Enumerator , n , n ) for i := uint ( 0 ) ; i < n ; i ++ { results [ i ] = make ( chan interface { } ) cast [ i ] = results [ i ] } go func ( ) { for i := uint ( 0 ) ; i < n ; i ++ { go func ( addr uint ) { defer close ( results [ addr ] ) for { read , ok := <- iter if ! ok { return } results [ addr ] <- operation ( read ) } } ( i ) } } ( ) return cast }
// splitN creates N Enumerators, each will be a subset of the original Enumerator and will have
// distinct populations from one another.
splitN creates N Enumerators each will be a subset of the original Enumerator and will have distinct populations from one another .