# elliotchance/pie

🍕 Enjoy a slice! A utility library for dealing with slices and maps that focuses on type safety and performance.

Repository: https://github.com/elliotchance/pie
Canonical: https://ross.abutalabs.com/products/elliotchance-pie
Homepage: https://pkg.go.dev/github.com/elliotchance/pie/v2
Language: Go
License: MIT
License Family: permissive
Topics: golang, go, utility, slices, generics
Last push: 2025-12-22T20:53:42+00:00

## Health v2 (maintenance only)
Score: 49/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 58, release rhythm 8, longevity 100
- inputs: {"age_days": 2711, "days_push": 254, "days_rel": 645, "gap_med": null, "n_releases_24m": 1}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2038, forks 95 (observed 2026-08-28T04:06:08.212891+00:00)

## What it is
pie is a Go utility library providing type-safe, performant functions for common operations on slices and maps using generics. It supports both standalone parameterized functions and chainable wrappers (pie.Of, pie.OfOrdered, pie.OfNumeric) for Go 1.18+.

## Use cases
- filter and map over Go slices with type safety
- chain multiple slice transformations in Go
- check if any or all slice elements match a condition
- compute average, sum, or other numeric aggregations of a slice
- deduplicate, diff, or chunk slices
- replace verbose hand-written slice loops with utility functions

## When to choose
- you write lots of slice/map manipulation code in Go 1.18+
- you want generics-based type safety instead of interface{}-based libraries
- performance close to native Go loops matters

## When to avoid
- you are on Go 1.17 or earlier (use pie v1 instead)
- you prefer the standard library slices package with no extra dependency
- you need complex data transformation beyond simple slice/map operations

## Facets
- artifact type: library
- maturity: stable
- function: developer-tools
- domain: developer-tools
- platform: go
- tags: slices, maps, generics, utility-library, functional-programming, type-safety, algorithms

## Member repositories
- elliotchance/pie (main) score 49

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:08.212891+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:59:14.408968+00:00, confidence not recorded.
  - readme: https://github.com/elliotchance/pie (fetched 2026-08-28T04:06:08.212891+00:00, sha 3393aff25a07)
  - homepage: https://pkg.go.dev/github.com/elliotchance/pie/v2 (fetched 2026-08-29T10:38:38.011712+00:00, sha f3ceb3ea468f)
  - site_page: https://pkg.go.dev/about (fetched 2026-08-29T10:38:38.015462+00:00, sha 757852027879)
  - site_page: https://go.dev/project (fetched 2026-08-29T10:38:38.017330+00:00, sha d5ca00bb378b)
- Data as of 2026-08-30T08:39:29.467469+00:00.
