{"id":16870204,"url":"https://github.com/metagn/applicates","last_synced_at":"2025-03-18T19:38:20.800Z","repository":{"id":149520060,"uuid":"316634369","full_name":"metagn/applicates","owner":"metagn","description":"generalized compile time routine and symbol pointers","archived":false,"fork":false,"pushed_at":"2024-09-27T08:52:49.000Z","size":130,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-14T15:03:05.236Z","etag":null,"topics":["functional-programming","library","macros","nim","optimization","templates"],"latest_commit_sha":null,"homepage":"https://metagn.github.io/applicates/docs/applicates.html","language":"Nim","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/metagn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"metagn","custom":"https://www.buymeacoffee.com/metagn"}},"created_at":"2020-11-28T01:33:11.000Z","updated_at":"2024-09-27T08:52:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"413ec1f2-5208-41f3-b5eb-fddb296dd0db","html_url":"https://github.com/metagn/applicates","commit_stats":{"total_commits":40,"total_committers":3,"mean_commits":"13.333333333333334","dds":0.275,"last_synced_commit":"4e410abb6f9ae8292a06fded8b33fd967ca17df9"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metagn%2Fapplicates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metagn%2Fapplicates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metagn%2Fapplicates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metagn%2Fapplicates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/metagn","download_url":"https://codeload.github.com/metagn/applicates/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244290423,"owners_count":20429361,"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":["functional-programming","library","macros","nim","optimization","templates"],"created_at":"2024-10-13T15:03:11.503Z","updated_at":"2025-03-18T19:38:20.774Z","avatar_url":"https://github.com/metagn.png","language":"Nim","readme":"# applicates\n\nGeneralized routine and symbol pointers, achieved by instantiating cached\nroutine definitions or symbols. The cached AST is referenced by a key,\nthis key is passed around as a compile time value to be instantiated.\n\nThis allows for fully inlined lambdas via anonymous templates, which is\nthe construct that the macros in this library mainly focus on.\n\n```nim\nimport applicates\n\n# `ApplicateArg` is `static Applicate`\nproc map[T](s: seq[T], f: ApplicateArg): seq[T] =\n  result.newSeq(s.len)\n  for i in 0..\u003cs.len:\n    let x = s[i]\n    result[i] = f.apply(x) # inlined at AST level\n    # with `import applicates/calloperator`:\n    result[i] = f(x)\n    result[i] = x.f\n    # with `import applicates/operators`:\n    result[i] = \\f(x)\n    result[i] = \\x.f\n    result[i] = x |\u003e f\n\nassert @[1, 2, 3, 4, 5].map(applicate do (x: int) -\u003e int: x - 1) == @[0, 1, 2, 3, 4]\nassert @[1, 2, 3, 4, 5].map(toApplicate(succ)) == @[2, 3, 4, 5, 6]\nconst double = x ==\u003e x * 2\nassert @[1, 2, 3, 4, 5].map(double) == @[2, 4, 6, 8, 10]\n```\n\nSee [docs](https://metagn.github.io/applicates/docs/applicates.html) and\n[tests](https://github.com/metagn/applicates/tree/master/tests) for more\nexample uses of this library. Tests are ran for multiple backends.\n\nNote: Since `Applicate` is implemented as `distinct ApplicateKey` and is also usually used as `static Applicate` (for which `ApplicateArg` is an alias), this library fairly pushes Nim's type system, and errors are likely to be cryptic.\n","funding_links":["https://github.com/sponsors/metagn","https://www.buymeacoffee.com/metagn"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetagn%2Fapplicates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetagn%2Fapplicates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetagn%2Fapplicates/lists"}