{"id":20979009,"url":"https://github.com/1pkg/gamb","last_synced_at":"2026-05-23T14:31:25.804Z","repository":{"id":57576297,"uuid":"356849771","full_name":"1pkg/gamb","owner":"1pkg","description":"go amb (ambiguous) operator implementation","archived":false,"fork":false,"pushed_at":"2021-04-12T21:16:26.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-31T00:31:48.750Z","etag":null,"topics":["ambiguous","go","golang","operator"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/1pkg.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}},"created_at":"2021-04-11T11:32:25.000Z","updated_at":"2021-04-12T20:12:15.000Z","dependencies_parsed_at":"2022-08-29T00:51:40.309Z","dependency_job_id":null,"html_url":"https://github.com/1pkg/gamb","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/1pkg/gamb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1pkg%2Fgamb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1pkg%2Fgamb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1pkg%2Fgamb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1pkg%2Fgamb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/1pkg","download_url":"https://codeload.github.com/1pkg/gamb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1pkg%2Fgamb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33400245,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-23T04:15:53.637Z","status":"ssl_error","status_checked_at":"2026-05-23T04:15:53.242Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["ambiguous","go","golang","operator"],"created_at":"2024-11-19T05:10:31.245Z","updated_at":"2026-05-23T14:31:25.786Z","avatar_url":"https://github.com/1pkg.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gamb: go amb (ambiguous) operator implementation\n\n[![lint](https://github.com/1pkg/gamb/workflows/lint/badge.svg)](https://github.com/1pkg/gamb/actions?query=workflow%3Alint+branch%3Amaster+)\n[![build](https://github.com/1pkg/gamb/workflows/build/badge.svg)](https://github.com/1pkg/gamb/actions?query=workflow%3Abuild+branch%3Amaster+)\n[![report](https://goreportcard.com/badge/github.com/1pkg/gamb?nocache)](https://goreportcard.com/report/github.com/1pkg/gamb)\n[![version](https://img.shields.io/github/go-mod/go-version/1pkg/gamb?nocache)](https://github.com/1pkg/gamb/blob/master/go.mod)\n[![license](https://img.shields.io/github/license/1pkg/gamb?nocache)](LICENSE)\n\n`go get -u github.com/1pkg/gamb`\n\n## Details\n\nThis package provides generic variadic implemention of [McCarthy's Ambiguous Operator](https://rosettacode.org/wiki/Amb) in go. Gamb exposes three ambiguous functions `Amb` to yield first variable matching ambiguous predicate; `All` to yield all variables matching ambiguous predicate; `Ord` to yield first strict ordered variable matching ambiguous predicate in single pass. Ambiguous predicate is defined as function `func(v ...interface{}) bool` that accepts ambiguous variable sets permutations and check some bolean condition against them.\n\n```go\n    out := Amb(\n        func(v ...interface{}) bool {\n            return v[0].(int)+v[1].(int)-v[2].(int) == 7\n        }\n        NewVar(10, 20, 30),\n        NewVar(1, 2, 3, 5, 10),\n        NewVar(2, 3, 4),\n    )\n    fmt.Println(out) // [10 1 4]\n```\n\n```go\n    out := All(\n        func(v ...interface{}) bool {\n            return v[0].(int)+v[1].(int)-v[2].(int) == 7\n        }\n        NewVar(10, 20, 30),\n        NewVar(1, 2, 3, 5, 10),\n        NewVar(2, 3, 4),\n    )\n    fmt.Println(out) // [[10 1 4], [10, 2, 3], [10, 3, 2]]\n```\n\n```go\n    out := Ord(\n        func(v ...interface{}) bool {\n            return v[0].(int)+v[1].(int)-v[2].(int) == 31\n        }\n        NewVar(10, 20, 30),\n        NewVar(1, 2, 3, 5, 10),\n        NewVar(2, 3, 4),\n    )\n    fmt.Println(out) // [30 5 4]\n```\n\n**Note:** ambiguous operator generally requires some form of backtracking with `n^m` operators, where `n` - size of ambiguous variable and `m` - number of ambiguous variables (for `ord` operator single pass is used reducing complexity to `n`). Therefore ambiguous operator is not efficient on processing big inputs.\n\n## Licence\n\nGamb is licensed under the MIT License.  \nSee [LICENSE](LICENSE) for the full license text.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1pkg%2Fgamb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F1pkg%2Fgamb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1pkg%2Fgamb/lists"}