Created
          April 5, 2016 12:15 
        
      - 
      
- 
        Save localhots/f8b59c507353a5db8ca6af08b91cb83b to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | func processWithBatches(items []uint32, batchSize int, f func(batch []uint32)) { | |
| if len(items) == 0 { | |
| return | |
| } | |
| if len(items) <= batchSize { | |
| f(items) | |
| } else { | |
| f(items[:batchSize]) | |
| processWithBatches(items[batchSize:], batchSize, f) | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment