Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
orsinium committed Sep 24, 2019
1 parent 9d97720 commit d0456b1
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 6 deletions.
60 changes: 54 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,65 @@
# Genesis

Typesafe generic functions for Go: filter, map, reduce, min, find etc.
Myssed generic stdlib for slices and channels.

**Some functions:**

+ Filter, Map, Reduce.
+ Min, Max, Sum.
+ Permutations, Product.
+ Any, All.
+ Contains, Find.
+ Shuffle, Sort.
+ Range, Count, Cycle.

And much more.

**Features:**

+ Typesafe.
+ Sync and async versions.
+ For slices and channels.
+ Pre-generated for all built-in types.

```bash
go get github.com/life4/genesis
```

## Contributing
## Examples

Find minimal value in a slice of ints:

```go
s := []int{42, 7, 13}
min = genesis.SliceInt{s}.Min()
```

Double values in a slice of ints:

```go
s := []int{4, 8, 15, 16, 23, 42}
double := func(el int) int { return el * 2 }
doubled = genesis.SliceInt{s}.Map(double)
```

See [docs](./docs) to dive deeper.

## Generation

Install requirements

```bash
python3 -m pip install --user -r requirements.txt
```

Re-generate everything for built-in types:

```bash
python3 -m generate
```

Generate:
Generate a new package with given types:

```bash
go get -u github.com/mmatczuk/go_generics/cmd/go_generics
go get -u github.com/mmatczuk/go_generics/cmd/go_merge
python3 generate.py
python3 -m generate
```
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
attrs
parse
jinja2

0 comments on commit d0456b1

Please sign in to comment.