{"id":18000140,"url":"https://github.com/kabie/named_fn","last_synced_at":"2025-09-01T05:35:12.793Z","repository":{"id":62429999,"uuid":"287912485","full_name":"Kabie/named_fn","owner":"Kabie","description":"Named function for Elixir.","archived":false,"fork":false,"pushed_at":"2022-01-09T14:39:31.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T07:43:58.203Z","etag":null,"topics":["elixir","elixir-lang"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kabie.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":"2020-08-16T09:27:47.000Z","updated_at":"2021-12-23T11:46:50.000Z","dependencies_parsed_at":"2022-11-01T19:47:18.791Z","dependency_job_id":null,"html_url":"https://github.com/Kabie/named_fn","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Kabie/named_fn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kabie%2Fnamed_fn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kabie%2Fnamed_fn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kabie%2Fnamed_fn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kabie%2Fnamed_fn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kabie","download_url":"https://codeload.github.com/Kabie/named_fn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kabie%2Fnamed_fn/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273077227,"owners_count":25041358,"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","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["elixir","elixir-lang"],"created_at":"2024-10-29T23:09:50.293Z","updated_at":"2025-09-01T05:35:12.766Z","avatar_url":"https://github.com/Kabie.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NamedFn\n\nNamed function for Elixir.\n\nErlang added named fun for some time. While Elixir havn't adopt it yet. This package is a workaround.\n\n## Usage\n\nEquivalent to:\n\n```erlang\nFactorial = fun\n  F(0) -\u003e 1;\n  F(X) when X \u003e 0 -\u003e X * F(X - 1)\nend.\n```\n\nWe have:\n\n```elixir\nfactorial = named_fn :f do\n  0 -\u003e 1\n  x when x \u003e 0 -\u003e x * f(x - 1)\nend\n```\n\n## Limitations\n\nCurrently this heavily depend on Elixir and Erlang compiler. So it may break if underlaying APIs changed.\n\nIf you define a named function with 0 arity, you can't call it inside body. Since it's hard to distinguish a call and a var, and we want to support using the function as a var.\n\n## Installation\n\nIf [available in Hex](https://hex.pm/docs/publish), the package can be installed\nby adding `named_fn` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:named_fn, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\nDocumentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)\nand published on [HexDocs](https://hexdocs.pm). Once published, the docs can\nbe found at [https://hexdocs.pm/named_fn](https://hexdocs.pm/named_fn).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkabie%2Fnamed_fn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkabie%2Fnamed_fn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkabie%2Fnamed_fn/lists"}