{"id":13439518,"url":"https://github.com/graphitemaster/lambdapp","last_synced_at":"2026-01-10T19:31:59.299Z","repository":{"id":49981747,"uuid":"20601436","full_name":"graphitemaster/lambdapp","owner":"graphitemaster","description":"Anonymous functions in C","archived":false,"fork":false,"pushed_at":"2020-06-15T23:30:11.000Z","size":48,"stargazers_count":248,"open_issues_count":0,"forks_count":17,"subscribers_count":18,"default_branch":"main","last_synced_at":"2024-10-28T01:12:54.803Z","etag":null,"topics":["anonymous-functions","c","lambda","nested-functions"],"latest_commit_sha":null,"homepage":null,"language":"C","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/graphitemaster.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":"2014-06-07T19:51:19.000Z","updated_at":"2024-09-25T18:50:32.000Z","dependencies_parsed_at":"2022-08-12T20:50:54.062Z","dependency_job_id":null,"html_url":"https://github.com/graphitemaster/lambdapp","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/graphitemaster%2Flambdapp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphitemaster%2Flambdapp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphitemaster%2Flambdapp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphitemaster%2Flambdapp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/graphitemaster","download_url":"https://codeload.github.com/graphitemaster/lambdapp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244577779,"owners_count":20475362,"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":["anonymous-functions","c","lambda","nested-functions"],"created_at":"2024-07-31T03:01:14.602Z","updated_at":"2026-01-10T19:31:59.270Z","avatar_url":"https://github.com/graphitemaster.png","language":"C","readme":"### Synposis\nLambdaPP is a preprocessor for giving you anonymous functions in C.\n\n### Examples\n```\n// for an example the table consists of a string keyed (room) of occupants\n// stored in a linked list.\nhashtable_t *table;\nhashtable_foreach(table,\n    lambda void(list_t *list) {\n        list_foreach(list,\n            lambda void(const char *occupant) {\n                printf(\"\u003e\u003e %s\\n\", occupant);\n            }\n        );\n    }\n);\n```\n\nClosures are not supported by this system. It's important to note these are not\nnested functions or blocks, for information on these please see the following\nlinks.\n\n[_Nested functions_](https://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html)\n\n[_Blocks_](http://clang.llvm.org/docs/Block-ABI-Apple.html)\n\nThis is a source translation that produces global functions and replaces instances\nof the lambda with the literal.\n\n### How it works\nGiven a lambda, a static function is created. The scope which implements the\nlambda is replaced with a reference to the static function by taking it's address.\n\n#### Example\n```\n(lambda void(void) { printf(\"Hello world\"); })();\n```\n\nWould be translated to\n```\nstatic void lambda_0(void);\n(\u0026lambda_0)();\nstatic void lambda_0(void) { printf(\"Hello world\"); }\n```\n\nTo better see how it works, here's the original example expanded:\n```\nhashtable_t *table;\nstatic void lambda_0(list_t *list);\nhashtable_foreach(table, \u0026lambda_0);\nstatic void lambda_1(const char *occupant);\nstatic void lambda_0(list_t *list) {\n    list_foreach(list, \u0026lambda_1);\n}\nstatic void lambda_1(const char *occupant) {\n    printf(\"\u003e\u003e %s\\n\", occupant);\n}\n```\n\n### Diagnostics\nLambdaPP inserts `#file` and `#line` directives into the source code such that\ncompiler diagnostics will still work.\n","funding_links":[],"categories":["C"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphitemaster%2Flambdapp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraphitemaster%2Flambdapp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphitemaster%2Flambdapp/lists"}