{"id":28271367,"url":"https://github.com/freeformz/seq","last_synced_at":"2025-12-15T12:01:54.880Z","repository":{"id":283768629,"uuid":"952814697","full_name":"freeformz/seq","owner":"freeformz","description":"Iterator utiliies for Golang","archived":false,"fork":false,"pushed_at":"2025-06-08T19:56:23.000Z","size":37,"stargazers_count":22,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-11T13:06:40.406Z","etag":null,"topics":["golang","golang-iter","golang-library","golang-module","golang-package","iterator","iterators"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/freeformz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-21T23:50:06.000Z","updated_at":"2025-06-08T19:56:08.000Z","dependencies_parsed_at":"2025-03-23T07:19:47.055Z","dependency_job_id":"dcd2af6f-12fc-477c-9cd1-5a2b0765351e","html_url":"https://github.com/freeformz/seq","commit_stats":null,"previous_names":["freeformz/seq","freeformz/iter"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freeformz%2Fseq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freeformz%2Fseq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freeformz%2Fseq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freeformz%2Fseq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/freeformz","download_url":"https://codeload.github.com/freeformz/seq/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freeformz%2Fseq/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259271909,"owners_count":22832106,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","golang-iter","golang-library","golang-module","golang-package","iterator","iterators"],"created_at":"2025-05-20T18:20:43.415Z","updated_at":"2025-12-15T12:01:54.488Z","avatar_url":"https://github.com/freeformz.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sequence (Iterator) Utilities for Golang\n\n![ci status](https://github.com/freeformz/seq/actions/workflows/ci.yaml/badge.svg?branch=main)\n[![Go Report Card](https://goreportcard.com/badge/github.com/freeformz/seq)](https://goreportcard.com/report/github.com/freeformz/seq)\n[![GoDoc](https://godoc.org/github.com/freeformz/seq?status.svg)](http://godoc.org/github.com/freeformz/seq)\n\nGolang's \"missing\" iterator/sequence functions.\n\n## Construction Functions\n\n### iter.Seq[T]\n\n* `With(...T) iter.Seq[T]`: Construct a sequence using the provided values\n* `FromChan(\u003c-chan T) iter.Seq[T]`: Returns a sequence that produces values until the channel is closed\n* `Repeat(int, T) iter.Seq[T]`: Returns a sequence which repeats the value n times\n\n### iter.Seq2[K,V]\n\n* `WithKV(...KV[K,V]) iter.Seq2[K,V]`: Construct a key-value sequence using the provided key-values\n* `RepeatKV(int, K, V) iter.Seq2[K,V]`: Returns a sequence which repeats the key-value pair n times\n\n## Conversion Functions\n\n* `ToChan(iter.Seq[T]) \u003c-chan T`: Returns a channel that produces values until the sequence is exhausted\n* `ToChanCtx(context.Context, iter.Seq[T]) \u003c-chan T`: Returns a channel that produces values until the sequence is exhausted or the context is canceled\n* `IterKV(iter.Seq[V], func(V) K) iter.Seq2[K,V]`: Converts an iter.Seq[V] to an iter.Seq2[K,V] using keyFn for keys\n* `IterK(iter.Seq2[K,V]) iter.Seq[K]`: Converts an iter.Seq2[K,V] to an iter.Seq[K] (keys only)\n* `IterV(iter.Seq2[K,V]) iter.Seq[V]`: Converts an iter.Seq2[K,V] to an iter.Seq[V] (values only)\n* `MapToKV(iter.Seq[T], func(T) (K,V)) iter.Seq2[K,V]`: Maps values to key-value pairs\n\n## Transformation Functions\n\n### Mapping\n\n* `Map(iter.Seq[T], func(T) O) iter.Seq[O]`: Maps the items in the sequence to another type\n* `MapKV(iter.Seq2[K,V], func(K,V) (K1,V1)) iter.Seq2[K1,V1]`: Maps the key-value pairs to other types\n\n### Filtering\n\n* `Filter(iter.Seq[T], func(T) bool) iter.Seq[T]`: Filter values by applying fn to each value\n* `FilterKV(iter.Seq2[K,V], func(K,V) bool) iter.Seq2[K,V]`: Filter key-value pairs by applying fn to each pair\n\n### Appending\n\n* `Append(iter.Seq[T], ...T) iter.Seq[T]`: Returns a new sequence with additional items appended\n* `AppendKV(iter.Seq2[K,V], ...KV[K,V]) iter.Seq2[K,V]`: Returns a new sequence with additional key-value pairs appended\n\n### Replacement\n\n* `Replace(iter.Seq[T], old, new T) iter.Seq[T]`: Replace old values with new values\n* `ReplaceKV(iter.Seq2[K,V], old, new KV[K,V]) iter.Seq2[K,V]`: Replace old key-value pairs with new ones\n\n### Compacting\n\n* `Compact(iter.Seq[T]) iter.Seq[T]`: Yields all values that are not equal to the previous value\n* `CompactFunc(iter.Seq[T], func(T,T) bool) iter.Seq[T]`: Like Compact but uses a function to compare elements\n* `CompactKV(iter.Seq2[K,V]) iter.Seq2[K,V]`: Yields all key-value pairs that are not equal to the previous pair\n* `CompactKVFunc(iter.Seq2[K,V], func(KV[K,V], KV[K,V]) bool) iter.Seq2[K,V]`: Like CompactKV but uses a function to compare pairs\n\n### Chunking\n\n* `Chunk(iter.Seq[T], int) iter.Seq[iter.Seq[T]]`: Chunk the sequence into chunks of specified size\n* `ChunkKV(iter.Seq2[K,V], int) iter.Seq[iter.Seq2[K,V]]`: Chunk key-value pairs into chunks of specified size\n\n### Dropping\n\n* `Drop(iter.Seq[T], int) iter.Seq[T]`: Drop n elements from the start of the sequence\n* `DropKV(iter.Seq2[K,V], int) iter.Seq2[K,V]`: Drop n key-value pairs from the start of the sequence\n* `DropBy(iter.Seq[T], func(T) bool) iter.Seq[T]`: Drop all elements for which the function returns true\n* `DropKVBy(iter.Seq2[K,V], func(K,V) bool) iter.Seq2[K,V]`: Drop all key-value pairs for which the function returns true\n\n## Aggregation Functions\n\n### Min/Max\n\n* `Min(iter.Seq[T]) (T, bool)`: Min value from the sequence using built-in comparison\n* `MinFunc(iter.Seq[T], func(T,T) int) (T, bool)`: Min value using a comparison function\n* `MinFuncKV(iter.Seq2[K,V], func(KV[K,V], KV[K,V]) int) (KV[K,V], bool)`: Min key-value pair using a comparison function\n* `Max(iter.Seq[T]) (T, bool)`: Max value from the sequence using built-in comparison\n* `MaxFunc(iter.Seq[T], func(T,T) int) (T, bool)`: Max value using a comparison function\n* `MaxFuncKV(iter.Seq2[K,V], func(KV[K,V], KV[K,V]) int) (KV[K,V], bool)`: Max key-value pair using a comparison function\n\n### Reduction\n\n* `Reduce(iter.Seq[T], O, func(O,T) O) O`: Reduce the sequence to a single value\n* `ReduceKV(iter.Seq2[K,V], O, func(O,K,V) O) O`: Reduce key-value pairs to a single value\n\n### Counting\n\n* `Count(iter.Seq[T]) int`: Returns the number of elements in the sequence\n* `CountKV(iter.Seq2[K,V]) int`: Returns the number of key-value pairs in the sequence\n* `CountBy(iter.Seq[T], func(T) bool) int`: Count elements for which the function returns true\n* `CountKVBy(iter.Seq2[K,V], func(K,V) bool) int`: Count key-value pairs for which the function returns true\n* `CountValues(iter.Seq[T]) iter.Seq2[T,int]`: Returns a sequence where keys are values and values are their counts\n\n## Comparison Functions\n\n* `Compare(iter.Seq[T], iter.Seq[T]) int`: Compare two sequences using cmp.Compare\n* `CompareFunc(iter.Seq[T], iter.Seq[T], func(T,T) int) int`: Compare two sequences using a comparison function\n* `CompareKV(iter.Seq2[K,V], iter.Seq2[K,V]) int`: Compare two key-value sequences using cmp.Compare\n* `CompareKVFunc(iter.Seq2[AK,AV], iter.Seq2[BK,BV], func(KV[AK,AV], KV[BK,BV]) int) int`: Compare two key-value sequences using a comparison function\n\n## Equality Functions\n\n* `Equal(iter.Seq[T], iter.Seq[T]) bool`: Returns true if sequences are equal\n* `EqualKV(iter.Seq2[K,V], iter.Seq2[K,V]) bool`: Returns true if key-value sequences are equal\n* `EqualFunc(iter.Seq[T], iter.Seq[T], func(T,T) bool) bool`: Test equality using a comparison function\n* `EqualKVFunc(iter.Seq2[AK,AV], iter.Seq2[BK,BV], func(KV[AK,AV], KV[BK,BV]) bool) bool`: Test key-value equality using a comparison function\n\n## Search Functions\n\n### Contains\n\n* `Contains(iter.Seq[T], T) bool`: Returns true if the value is in the sequence\n* `ContainsKV(iter.Seq2[K,V], K, V) bool`: Returns true if the key-value pair is in the sequence\n* `ContainsFunc(iter.Seq[T], func(T) bool) bool`: Returns true if predicate returns true for any value\n* `ContainsKVFunc(iter.Seq2[K,V], func(K,V) bool) bool`: Returns true if predicate returns true for any key-value pair\n\n### Finding\n\n* `Find(iter.Seq[T], T) (int, bool)`: Returns the index of the first occurrence of the value\n* `FindBy(iter.Seq[T], func(T) bool) (T, int, bool)`: Returns the first value for which the function returns true\n* `FindByKey(iter.Seq2[K,V], K) (V, int, bool)`: Returns the value of the first key-value pair with the given key\n* `FindByValue(iter.Seq2[K,V], V) (K, int, bool)`: Returns the key of the first key-value pair with the given value\n\n## Utility Functions\n\n* `Coalesce(iter.Seq[T]) (T, bool)`: Returns the first non-zero value in the sequence\n* `CoalesceKV(iter.Seq2[K,V]) (KV[K,V], bool)`: Returns the first key-value pair with a non-zero value\n* `IsSorted(iter.Seq[T]) bool`: Returns true if the sequence is sorted\n* `IsSortedKV(iter.Seq2[K,V]) bool`: Returns true if the key-value sequence is sorted\n* `IntK() func(V) int`: Returns a function that generates increasing integers starting at 0\n\n## Time-based Functions\n\n* `EveryUntil(time.Duration, time.Time) iter.Seq[time.Time]`: Yields time every duration until the specified time\n* `EveryN(time.Duration, int) iter.Seq[time.Time]`: Yields time every duration for n times\n\n## Types\n\n* `KV[K,V]`: A struct that pairs a key and value together for use with key-value sequence functions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreeformz%2Fseq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffreeformz%2Fseq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreeformz%2Fseq/lists"}