{"id":19793556,"url":"https://github.com/darky/functx","last_synced_at":"2025-05-01T02:30:43.281Z","repository":{"id":245003751,"uuid":"816944288","full_name":"darky/functx","owner":"darky","description":"Tiny Gleam caching Context for your functions","archived":true,"fork":false,"pushed_at":"2024-12-29T19:14:15.000Z","size":51,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-25T21:52:19.251Z","etag":null,"topics":["cache","context","gleam"],"latest_commit_sha":null,"homepage":"","language":"Gleam","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/darky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-06-18T17:43:38.000Z","updated_at":"2024-12-29T19:18:01.000Z","dependencies_parsed_at":"2024-08-10T12:20:33.332Z","dependency_job_id":"6d349b36-94e9-485a-ab69-aee7832212be","html_url":"https://github.com/darky/functx","commit_stats":null,"previous_names":["darky/functx"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darky%2Ffunctx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darky%2Ffunctx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darky%2Ffunctx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darky%2Ffunctx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/darky","download_url":"https://codeload.github.com/darky/functx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251812261,"owners_count":21647875,"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":["cache","context","gleam"],"created_at":"2024-11-12T07:10:20.646Z","updated_at":"2025-05-01T02:30:43.276Z","avatar_url":"https://github.com/darky.png","language":"Gleam","funding_links":[],"categories":[],"sub_categories":[],"readme":"# functx\n\n## Deprecated in favor [klubok-gleam](https://github.com/darky/klubok-gleam)\n\n[![Package Version](https://img.shields.io/hexpm/v/functx)](https://hex.pm/packages/functx)\n[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/functx/)\n![Erlang-compatible](https://img.shields.io/badge/target-erlang-a2003e)\n![JavaScript-compatible](https://img.shields.io/badge/target-javascript-f1e05a)\n\n![logo](logo.png)\n\nTiny Gleam caching Context for your functions\n\n```sh\ngleam add functx\n```\n\n```gleam\nimport functx.{type Ctx}\n\nfn nums(ctx: Ctx(Int)) {\n  // this function called only once during context\n\n  let #(n, _) = ctx\n\n  #([1, 2, 3, 4, 5, 6, 7, 8, 9, n], ctx)\n}\n\nfn nums_as_string(ctx) {\n  use ns, ctx \u003c- functx.call(ctx, nums)\n\n  let resp =\n    ns\n    |\u003e list.map(fn(n) { n |\u003e int.to_string })\n    |\u003e string.join(\",\")\n\n  #(resp, ctx)\n}\n\nfn nums_to_sum(ctx) {\n  use ns, ctx \u003c- functx.call(ctx, nums)\n\n  let resp = {\n    use acc, n \u003c- list.fold(ns, 0)\n    acc + n\n  }\n\n  #(resp, ctx)\n}\n\nfn nums_summary(ctx) {\n  use ns_str, ctx \u003c- functx.call(ctx, nums_as_string)\n  use ns_sum, ctx \u003c- functx.call(ctx, nums_to_sum)\n\n  let resp = \"Nums: \" \u003c\u003e ns_str \u003c\u003e \" Sum: \" \u003c\u003e ns_sum |\u003e int.to_string\n\n  #(resp, ctx)\n}\n\npub fn main() {\n  let resp =\n    10\n    |\u003e functx.make_ctx\n    |\u003e nums_summary\n\n  resp.0 // Nums: 1,2,3,4,5,6,7,8,9,10 Sum: 55\n}\n```\n\nFurther documentation can be found at \u003chttps://hexdocs.pm/functx\u003e.\n\n## Development\n\n```sh\ngleam run   # Run the project\ngleam test  # Run the tests\ngleam shell # Run an Erlang shell\n```\n\n## See also\n\n- [context-fp](https://github.com/darky/context-fp) - Functional programming context for TypeScript\n- [context-fp-go](https://github.com/darky/context-fp-go) - Functional programming context for Golang\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarky%2Ffunctx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarky%2Ffunctx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarky%2Ffunctx/lists"}