{"id":15168595,"url":"https://github.com/ciavash/curry","last_synced_at":"2025-10-01T00:32:28.783Z","repository":{"id":147481985,"uuid":"412897819","full_name":"CIAvash/Curry","owner":"CIAvash","description":"Curry is a Raku module for currying functions plus partially applying them","archived":true,"fork":false,"pushed_at":"2021-11-01T13:34:15.000Z","size":37,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-09-30T17:37:00.146Z","etag":null,"topics":["curried","curry","currying","functional-programming","functions","module","partial","partial-application","raku","rakulang","trait"],"latest_commit_sha":null,"homepage":"https://codeberg.org/CIAvash/Curry","language":"Raku","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CIAvash.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-10-02T19:51:52.000Z","updated_at":"2024-03-30T12:40:39.000Z","dependencies_parsed_at":"2023-07-25T00:31:41.731Z","dependency_job_id":null,"html_url":"https://github.com/CIAvash/Curry","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"15591b1c9f1831a4691c47f1ecce514a814d1275"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CIAvash%2FCurry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CIAvash%2FCurry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CIAvash%2FCurry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CIAvash%2FCurry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CIAvash","download_url":"https://codeload.github.com/CIAvash/Curry/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234803494,"owners_count":18889263,"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":["curried","curry","currying","functional-programming","functions","module","partial","partial-application","raku","rakulang","trait"],"created_at":"2024-09-27T06:23:21.334Z","updated_at":"2025-10-01T00:32:23.547Z","avatar_url":"https://github.com/CIAvash.png","language":"Raku","funding_links":[],"categories":[],"sub_categories":[],"readme":"NAME\n====\n\nCurry - a [Raku](https://www.raku-lang.ir/en) module for currying functions.\n\nDESCRIPTION\n===========\n\nCurry is a [Raku](https://www.raku-lang.ir/en) module for currying functions plus partially applying them.\n\nSYNOPSIS\n========\n\n```raku\nuse Curry:auth\u003czef:CIAvash\u003e :all;\n\n# Curried subs\nsub f ($a, $b) is curry {\n    $a × $b;\n}\nmy \u0026pf = f 2;\nsay pf 3;\n=output 6␤\n\nsub f2 ($a, $b, :$c = 1) is curry {\n    [×] $a, $b, $c;\n}\nmy \u0026pf2 = f 2, :c(4);\nsay pf 3;\n=output 24␤\n\nsub f3 (*@a) is curry {\n    [×] @a;\n}\nmy \u0026pf3 = f 2, 3;\nsay pf;\n=output 6␤\n\nsay pf(4)();\n=output 24␤\n\n# Curried method and attribute\nmy class C {\n    has \u0026.f is curry is rw;\n\n    method m (Int $a, Int $b) is curry {\n        $a × $b;\n    }\n}\nmy C $c .= new;\n# Method\nsay $c.m(2, 3)()\n=output 6␤\n\nmy \u0026pm = $c.m(2, 3);\nsay pm;\n=output 6␤\n\nsay pm(4)();\n=output 24␤\n\n# Attribute\n$c.f = * + *;\nsay $c.f.(1, 2);\n=output 3␤\n\nmy \u0026pa = $c.f.(1);\nsay pa 2;\n=output 3␤\n\n# Making Curry\nmy \u0026f3 = Curry[* + *];\n# Or\nmy \u0026f4 = make_curry * + *;\n\nmy \u0026cgrep = Curry[\u0026grep];\n# Or better\nmy \u0026cgrep2 = new_curry \u0026grep;\n\n# Be careful with this\nmake_curry \u0026grep;\n# Or\nmake_curryable \u0026grep; # This changes function's signature\n# Original function (before being curried)\nmy \u0026lost_grep = \u0026grep.original_function;\n```\n\nINSTALLATION\n============\n\nYou need to have [Raku](https://www.raku-lang.ir/en) and [zef](https://github.com/ugexe/zef), then run:\n\n```console\nzef install --/test \"Curry:auth\u003czef:CIAvash\u003e\"\n```\n\nor if you have cloned the repo:\n\n```console\nzef install .\n```\n\nTESTING\n=======\n\n```console\nprove -ve 'raku -I.' --ext rakutest\n```\n\nROLES\n=====\n\n## role Curry [Code:D $function]\n\nCurry role takes a function as parameter and does the `Callable` role\n\n### method CALL-ME\n\n```raku\nmethod CALL-ME(\n    |c\n) returns Mu\n```\n\nCalls the function if all parameters are provided or returns a partially applied function\n\n### method curry\n\n```raku\nmethod curry(\n    |c\n) returns Curry:D\n```\n\nLike `assuming` but returns a Curry. And tries to preserve the parameters of the partial function.\n\n### method original_function\n\n```raku\nmethod original_function() returns Code:D\n```\n\nReturns the original function, the function that was curried\n\n## role Curry::CaptureAll\n\nA role with a signature that captures all arguments\n\nSUBS\n====\n\n## multi sub make_curry\n\n```raku\nmulti sub make_curry(\n    Code:D $f\n) returns Curry:D is export(:all, :subs)\n```\n\nTakes a function, gives a cloned version of it to `Curry`, then adds the role to the function\n\n## multi sub make_curry\n\n```raku\nmulti sub make_curry(\n    *@f where { ... }\n) returns Array[Curry:D] is export(:all, :subs)\n```\n\nTakes functions, gives a cloned version of each to `Curry`, then adds the role to each function\n\n## multi sub new_curry\n\n```raku\nmulti sub new_curry(\n    Code:D $f\n) returns Curry:D is export(:all, :subs)\n```\n\nTakes a function, creates a copy of it with role `Curry` mixed in\n\n## multi sub new_curry\n\n```raku\nmulti sub new_curry(\n    *@f where { ... }\n) returns Array[Curry:D] is export(:all, :subs)\n```\n\nTakes functions, creates a copy of each with role `Curry` mixed in\n\n## multi sub make_curryable\n\n```raku\nmulti sub make_curryable(\n    Code:D $f\n) returns Curry:D is export(:all, :subs)\n```\n\nTakes a function and returns a curried function that does `Curry::CaptureAll`\n\n## multi sub make_curryable\n\n```raku\nmulti sub make_curryable(\n    *@f where { ... }\n) returns Array[Curry:D] is export(:all, :subs)\n```\n\nTakes functions and returns an array of curried functions that does `Curry::CaptureAll`\n\n## multi sub trait_mod:\u003cis\u003e\n\n```raku\nmulti sub trait_mod:\u003cis\u003e(\n    Sub:D $sub,\n    :$curry!\n) returns Mu is export(:all, :traits)\n```\n\n`is curry` trait for `Sub`; Makes the function a curried function that does `Curry::CaptureAll`\n\n## multi sub trait_mod:\u003cis\u003e\n\n```raku\nmulti sub trait_mod:\u003cis\u003e(\n    Method:D $method,\n    :$curry!\n) returns Mu is export(:all, :traits)\n```\n\n`is curry` trait for `Method`; Makes the function a curried function that does `Curry::CaptureAll`\n\n## multi sub trait_mod:\u003cis\u003e\n\n```raku\nmulti sub trait_mod:\u003cis\u003e(\n    Attribute:D $attribute,\n    :$curry!\n) returns Mu is export(:all, :traits)\n```\n\n`is curry` trait for `Attribute`; Makes the function a curried function that does `Curry::CaptureAll`.\n\nIf you want to be able to set the function from outside of the class, you need to make the attribute writable\nwith `is rw`. Setting the attribute with `new` doesn't work, only assignment works.\n\nREPOSITORY\n==========\n\n[https://github.com/CIAvash/Curry/](https://github.com/CIAvash/Curry/)\n\nBUG\n===\n\n[https://github.com/CIAvash/Curry/issues](https://github.com/CIAvash/Curry/issues)\n\nAUTHOR\n======\n\nSiavash Askari Nasr - [https://www.ciavash.name](https://www.ciavash.name)\n\nCOPYRIGHT\n=========\n\nCopyright © 2021 Siavash Askari Nasr\n\nLICENSE\n=======\n\nThis file is part of Curry.\n\nCurry is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\nCurry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public License along with Curry. If not, see \u003chttp://www.gnu.org/licenses/\u003e.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fciavash%2Fcurry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fciavash%2Fcurry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fciavash%2Fcurry/lists"}