{"id":20977239,"url":"https://github.com/technologicat/spicy","last_synced_at":"2026-04-01T20:42:57.154Z","repository":{"id":129172545,"uuid":"129162540","full_name":"Technologicat/spicy","owner":"Technologicat","description":"Automatic currying for Racket","archived":false,"fork":false,"pushed_at":"2018-09-04T10:26:28.000Z","size":16,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-01T09:11:05.203Z","etag":null,"topics":["curry","currying","example","racket","racket-lang"],"latest_commit_sha":null,"homepage":null,"language":"Racket","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/Technologicat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2018-04-11T22:42:45.000Z","updated_at":"2021-04-28T19:18:22.000Z","dependencies_parsed_at":"2023-04-24T06:46:04.420Z","dependency_job_id":null,"html_url":"https://github.com/Technologicat/spicy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Technologicat/spicy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Technologicat%2Fspicy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Technologicat%2Fspicy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Technologicat%2Fspicy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Technologicat%2Fspicy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Technologicat","download_url":"https://codeload.github.com/Technologicat/spicy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Technologicat%2Fspicy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31291775,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T13:12:26.723Z","status":"ssl_error","status_checked_at":"2026-04-01T13:12:25.102Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["curry","currying","example","racket","racket-lang"],"created_at":"2024-11-19T04:57:43.623Z","updated_at":"2026-04-01T20:42:57.130Z","avatar_url":"https://github.com/Technologicat.png","language":"Racket","readme":"# spicy: Automatic currying for Racket\n\n```racket\n#lang spicy\n\n(define (map f)\n  (foldr (compose cons f) empty))\n\n(module+ main\n  (define a '(1 2 3))\n  (define (f x) (* x x))\n  (map f a))\n```\n\nCompare **not** spicy:\n\n```racket\n#lang racket\n\n(define (-\u003e1 f) (λ (a b) (values (f a) b)))\n(define (map f . args)\n  (apply curry foldr (compose cons (-\u003e1 f)) empty args))\n\n(module+ main\n  (define a '(1 2 3))\n  (define (f x) (* x x))\n  (map f a))\n```\n\nFor fewer parentheses, combine spicy with [sweet-exp](https://docs.racket-lang.org/sweet/):\n\n```racket\n#lang sweet-exp spicy\n\ndefine map(f)\n  foldr (compose cons f) empty\n\nmodule+ main\n  define a '(1 2 3)\n  define (f x) (* x x)\n  map f a\n```\n\nTo spice locally, `spicy/sauce`:\n\n```racket\n#lang sweet-exp racket\n\nrequire spicy/sauce\n\nmodule+ main\n  with-curry\n    define mymap-local(f)\n      foldr (compose cons f) empty\n    mymap-local\n      λ (x) {x * x}\n      '(1 2 3)\n  ;\n  splicing-with-curry\n    define mymap(f)\n      foldr (compose cons f) empty\n  ;; now autocurry is off\n  (mymap (λ (x) {x * x}))\n    '(1 2 3)\n```\n\n## Examples\n\nSome more simple examples, based on those in [Hughes (1984): Why functional programming matters](http://www.cse.chalmers.se/~rjmh/Papers/whyfp.pdf) and racketified.\n\n - [Spicy, with traditional s-expressions](example_sexp.rkt)\n - [Spicy, with sweet expressions](example_sweet.rkt)\n - [Not spicy](example_nonspicy.rkt)\n\nFor details, take the [tour](tour.rkt).\n\n## Human-readable rules\n\n - All function applications are curried. Currying is applied from the left.\n - Keyword arguments can be passed in the initial call, just like when currying manually in Racket.\n - Any arguments over max-arity are *passed through on the right*, by constructing a multiple-values object.\n   - This makes the above example possible, although the arities of `f` and `cons` are different.\n - If the application also returns a multiple-values, the remaining arguments (if any) are appended into it.\n - If the application produces only one value, which is another curried procedure, it is applied to the remaining arguments.\n   - See the [tour](tour.rkt) for where this is useful.\n - The auto-curried procedure immediately switches to the mode where *any acceptable arity* triggers a call.\n   - In contrast, currying manually in Racket always curries at least once (if a higher arity exists).\n   - Hence some variadic functions (notably e.g. `+`, `*`) cannot be auto-curried in `spicy`, since they accept any arity ≥ 0.\n   - Curry manually to revert to Racket's usual processing: `+ 1` → 1, but `curry + 1` → `#\u003cprocedure:curried\u003e`.\n     - It will still use the customized `curry` function from `spicy`, but skips the automatic mode switching.\n\n## Installation\n\n - Copy the files anywhere you want.\n - Open a terminal in the `spicy/` subfolder.\n - `raco pkg install`\n\nTo uninstall, `raco pkg remove spicy`.\n\n## How it works\n\nEssentially, a custom `#%app` macro to rewrite function applications at compile time, a customized `curry`, and [four lines of code](spicy/main.rkt) to package that as a language that borrows everything else from Racket.\n\nAlso, the [`compose`](https://docs.racket-lang.org/reference/procedures.html#%28def._%28%28lib._racket%2Fprivate%2Flist..rkt%29._compose%29%29) function is overridden by a curry-aware version, which spices its arguments.\n\n## Disclaimer\n\nPrimarily meant for teaching purposes. Tested only on toy examples.\n\nNot completely seamless, and cannot be. Automatic currying and variadic functions do not play well together; also, dynamic typing implies that the system won't notice if you miss an argument somewhere - which may make your code hard to debug. For discussion on the topic, see e.g. [here](https://stackoverflow.com/questions/11218905/is-it-possible-to-implement-auto-currying-to-the-lisp-family-languages), [here](http://paqmind.com/blog/currying-in-lisp/) and [here](https://stackoverflow.com/questions/31373507/rich-hickeys-reason-for-not-auto-currying-clojure-functions).\n\n## License\n\n[GNU LGPL 3.0](https://www.gnu.org/licenses/lgpl-3.0.html).\n\nContains a customized version of Racket's [`curry`](https://docs.racket-lang.org/reference/procedures.html#%28def._%28%28lib._racket%2Ffunction..rkt%29._curry%29%29), which is [used under](https://download.racket-lang.org/license.html) GNU LGPL 3.0.\n\n## Dependencies\n\n - [sweet-exp](https://docs.racket-lang.org/sweet/) is currently used by the implementation in [spicy/expander.rkt](spicy/expander.rkt).\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechnologicat%2Fspicy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftechnologicat%2Fspicy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechnologicat%2Fspicy/lists"}