<commit_before># Go Type-Agnostic Collection Partitioning

[![GoDoc](https://godoc.org/github.com/meirf/gopart?status.png)](https://godoc.org/github.com/meirf/gopart) [![Travis](https://travis-ci.org/meirf/gopart.svg?branch=master)](https://travis-ci.org/meirf/gopart)

Type-agnostic partitioning for anything that can be indexed in Go - slices, arrays,`string`s. Inspired by [Guava's Lists.partition](http://guava-libraries.googlecode.com/svn/tags/release09/javadoc/com/google/common/collect/Lists.html#partition(java.util.List, int)).

## Usage

```go
	for idxRange := range gopart.Partition(len(bigList), partitionSize) {
	    bulkOperation(bigList[idxRange.Low:idxRange.High])
	}
```

## Installation

    # install the library:
    go get github.com/meirf/gopart
    
    // use in your .go code:
    import (
        "github.com/meirf/gopart"
    )
<commit_msg>add comment to usage<commit_after># Go Type-Agnostic Collection Partitioning

[![GoDoc](https://godoc.org/github.com/meirf/gopart?status.png)](https://godoc.org/github.com/meirf/gopart) [![Travis](https://travis-ci.org/meirf/gopart.svg?branch=master)](https://travis-ci.org/meirf/gopart)

Type-agnostic partitioning for anything that can be indexed in Go - slices, arrays,`string`s. Inspired by [Guava's Lists.partition](http://guava-libraries.googlecode.com/svn/tags/release09/javadoc/com/google/common/collect/Lists.html#partition(java.util.List, int)).

## Usage

```go
    // bigList can be any type
	for idxRange := range gopart.Partition(len(bigList), partitionSize) {
	    bulkOperation(bigList[idxRange.Low:idxRange.High])
	}
```

## Installation

    # install the library:
    go get github.com/meirf/gopart
    
    // use in your .go code:
    import (
        "github.com/meirf/gopart"
    )

{'fraction_non_alphanumeric': 0.15575620767494355, 'fraction_numerical': 0.002257336343115124, 'mean_word_length': 4.094827586206897, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6827205', 'n_tokens_mistral': 665, 'n_tokens_neox': 642, 'n_words': 100}