{"id":18493596,"url":"https://github.com/hunkyjimpjorps/gary","last_synced_at":"2026-01-24T00:08:25.840Z","repository":{"id":237275096,"uuid":"794182273","full_name":"hunkyjimpjorps/gary","owner":"hunkyjimpjorps","description":"A Gleam interface to Erlang's array module, for sparse, efficiently-implemented functional arrays. 🐝","archived":false,"fork":false,"pushed_at":"2024-12-10T18:45:05.000Z","size":16,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-07T07:15:24.792Z","etag":null,"topics":["arrays","beam","erlang-otp","gleam"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/gary","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/hunkyjimpjorps.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-04-30T16:02:33.000Z","updated_at":"2024-12-10T18:43:21.000Z","dependencies_parsed_at":"2024-04-30T17:25:14.514Z","dependency_job_id":"16158693-e5ee-4d8b-9e96-294d468ebcd1","html_url":"https://github.com/hunkyjimpjorps/gary","commit_stats":null,"previous_names":["hunkyjimpjorps/gary"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunkyjimpjorps%2Fgary","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunkyjimpjorps%2Fgary/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunkyjimpjorps%2Fgary/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunkyjimpjorps%2Fgary/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hunkyjimpjorps","download_url":"https://codeload.github.com/hunkyjimpjorps/gary/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238766458,"owners_count":19526848,"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":["arrays","beam","erlang-otp","gleam"],"created_at":"2024-11-06T13:15:21.655Z","updated_at":"2025-10-31T15:30:26.998Z","avatar_url":"https://github.com/hunkyjimpjorps.png","language":"Gleam","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gary\n\nA Gleam interface to Erlang's `array` module, for sparse, efficiently-implemented functional arrays. 🐝\n\n[![Package Version](https://img.shields.io/hexpm/v/gary)](https://hex.pm/packages/gary)\n[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/gary/)\n\n## When should I use `gary`?  When are other data types better?\n\nErlang arrays are $O(\\log n)$ for both lookups and updates.  If you don't remember big-O notation, for the purposes of this explanation that essentially means \"faster than $O(n)$ (linear time), but slower than $O(1)$ (constant time)\".\n\nTuples are $O(1)$ for lookups, but $O(n)$ for updates -- you can lookup a tuple by its index without iterating over the tuple, but the entire tuple has to be copied to a new location in memory to update one of its values.  Tuples are faster when you're doing repeated random lookups on an unchanging set of values, but lose out to arrays when random updates are required.  \n\n[`glearray`](https://hex.pm/packages/glearray)'s version of arrays are represented as a single tuple, so if you're solely doing lookups and don't need the sparse representation or dynamically resizeable arrays, `glearray` will likely be faster than `gary` .\n\nLists are $O(n)$ for both lookups and updates anywhere but the head of the list, since you need to iterate over the pairs of the linked list to find an arbitrary index within it.  Lists will be faster that arrays if you can ensure that you only ever operate at the head of the list, like in most traditional recursive algorithms.\n\n## Example\n\n```sh\ngleam add gary\n```\n\n```gleam\nimport gary/array\n\npub fn main() {\n  list.range(1, 10)\n      |\u003e array.from_list(default: -99)\n      |\u003e array.drop(at: 5)\n      |\u003e result.map(array.map(_, fn(_, v) { 2 * v }))\n      |\u003e result.map(array.to_list)\n  // = Ok([2, 4, 6, 8, 10, -198, 14, 16, 18, 20])\n}\n```\n\nFurther documentation can be found at \u003chttps://hexdocs.pm/gary\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhunkyjimpjorps%2Fgary","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhunkyjimpjorps%2Fgary","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhunkyjimpjorps%2Fgary/lists"}