{"id":15693166,"url":"https://github.com/code-hex/yc","last_synced_at":"2025-03-30T13:10:26.302Z","repository":{"id":71655628,"uuid":"502771598","full_name":"Code-Hex/yc","owner":"Code-Hex","description":"YC is the Y combinator in Go with generics","archived":false,"fork":false,"pushed_at":"2022-06-13T10:57:16.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-05T14:42:16.990Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Code-Hex.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":"2022-06-13T01:41:41.000Z","updated_at":"2022-06-13T01:42:11.000Z","dependencies_parsed_at":"2023-05-13T09:15:50.606Z","dependency_job_id":null,"html_url":"https://github.com/Code-Hex/yc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Code-Hex%2Fyc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Code-Hex%2Fyc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Code-Hex%2Fyc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Code-Hex%2Fyc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Code-Hex","download_url":"https://codeload.github.com/Code-Hex/yc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246320192,"owners_count":20758410,"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":[],"created_at":"2024-10-03T18:42:02.505Z","updated_at":"2025-03-30T13:10:26.276Z","avatar_url":"https://github.com/Code-Hex.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YC\n\nYC is the Y combinator in Go with generics\n\nThis package is written based on the content of \"[The Y combinator in Go with generics](https://eli.thegreenplace.net/2022/the-y-combinator-in-go-with-generics/)\".\n\nImplemented the Y combinator and some adaptions (e.g. memoize, tracing) for it.\n\n## Synopsis\n\n```go\npackage main\n\nvar factorialTag = func(recurse yc.Func[int, int]) yc.Func[int, int] {\n\treturn func(n int) int {\n\t\tif n == 0 {\n\t\t\treturn 1\n\t\t}\n\t\treturn n * recurse(n-1)\n\t}\n}\n\nfunc main() {\n    fac := yc.Y(yc.Adapt(factorialTag, yc.Memo[int, int](), yc.Trace[int, int]()))\n    got := fac(10)\n    fmt.Println(got) // 3628800\n}\n```\n\n## Run tests\n\n```\n$ go test -timeout 30s ./... github.com/Code-Hex/yc\n```\n\n## Run benchmark\n\n```\n$ go test -benchmem -bench . github.com/Code-Hex/yc\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode-hex%2Fyc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcode-hex%2Fyc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode-hex%2Fyc/lists"}