{"id":20924013,"url":"https://github.com/justinlubin/cobbler","last_synced_at":"2025-05-13T16:30:51.955Z","repository":{"id":225433497,"uuid":"528940735","full_name":"justinlubin/cobbler","owner":"justinlubin","description":"Refactor programs to use library functions","archived":false,"fork":false,"pushed_at":"2024-06-28T21:27:45.000Z","size":35804,"stargazers_count":5,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-13T12:54:53.908Z","etag":null,"topics":["elm","numpy","program-synthesis","python","refactoring"],"latest_commit_sha":null,"homepage":"","language":"OCaml","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/justinlubin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2022-08-25T16:54:11.000Z","updated_at":"2025-01-07T23:00:30.000Z","dependencies_parsed_at":"2024-03-20T03:28:08.985Z","dependency_job_id":"58ebf739-cf78-4073-82d5-e7f7603abafd","html_url":"https://github.com/justinlubin/cobbler","commit_stats":null,"previous_names":["justinlubin/cobbler"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinlubin%2Fcobbler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinlubin%2Fcobbler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinlubin%2Fcobbler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinlubin%2Fcobbler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/justinlubin","download_url":"https://codeload.github.com/justinlubin/cobbler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253981684,"owners_count":21994317,"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":["elm","numpy","program-synthesis","python","refactoring"],"created_at":"2024-11-18T20:18:48.294Z","updated_at":"2025-05-13T16:30:48.447Z","avatar_url":"https://github.com/justinlubin.png","language":"OCaml","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://jlubin.net/assets/cobbler-banner.png\" alt=\"cobbler\"\u003e\n\u003c/div\u003e\n\n# `cobbler`\n\n[![Tests](https://github.com/justinlubin/component-based-refactoring/actions/workflows/workflow.yml/badge.svg)](https://github.com/justinlubin/component-based-refactoring/actions/workflows/workflow.yml)\n\n`cobbler` refactors programs to use library functions.\n\nIt currently supports refactoring:\n\n- **[Elm](https://elm-lang.org/) programs** to use functions like those found in\n  the Elm Standard Library (e.g. `map` and `filter`); specifically, the ones\n  defined in [this file](backend/bin/Stdlib.elm)\n- **Python programs** to use the [NumPy](https://numpy.org/) high-performance \n  computing library\n\n**How to run:** First, install `cobbler`'s dependencies by following the\ninstructions in [`DEPENDENCIES.md`](DEPENDENCIES.md); then, you can run\n`cobbler` via the `cobbler` script in the root of this repository.\n\n**For help:** Run `./cobbler --help`.\n\n**For information about how `cobbler` works:** Please see our\n[PLDI 2024 paper](https://doi.org/10.1145/3656453)!\n\n## Examples\n\n### Elm\n\n#### withDefault/map\n\nInput:\n\n```elm\nmain : (Int -\u003e Int) -\u003e Maybe Int -\u003e Int\nmain f mx =\n case mx of\n   Nothing -\u003e 0\n   Just x -\u003e f (f x)\n```\n\nOutput:\n\n```elm\nmain : (Int -\u003e Int) -\u003e Maybe Int -\u003e Int\nmain f mx =\n    mx\n        |\u003e Maybe.map (\\x -\u003e f (f x))\n        |\u003e Maybe.withDefault 0\n```\n\n#### concat/map/filter\n\nInput:\n\n```elm\nmain : (String -\u003e Bool) -\u003e (String -\u003e List Int) -\u003e List String -\u003e List Int\nmain p f list =\n  case list of\n    [] -\u003e []\n    head :: tail -\u003e if p head then f head ++ main p f tail else main p f tail\n```\n\nOutput:\n\n```elm\nmain : (String -\u003e Bool) -\u003e (String -\u003e List Int) -\u003e List String -\u003e List Int\nmain p f list =\n    list\n        |\u003e List.filter p\n        |\u003e List.map f\n        |\u003e List.concat\n```\n\n### Python\n\n#### Dot product\n\nInput:\n\n```python\ns = 0\nfor i in range(len(x)):\n    s += x[i] * y[i]\ns\n```\n\nOutput:\n\n```python\ns = np.sum(np.multiply(x, y[:len(x)]))\ns\n```\n\n#### Rolling sum\n\nInput:\n\n```python\ny = np.zeros(len(x) - WINDOW_SIZE + 1)\nfor i in range(len(y)):\n    s = 0\n    for j in range(WINDOW_SIZE):\n        s += x[i + j]\n    y[i] = s\ny\n```\n\nOutput:\n\n```python\ny = np.convolve(x, np.full(WINDOW_SIZE, 1), mode=\"valid\")\ny\n```\n\n## Additional information\n\n- For information about how this project is structured, please see\n[`ARCHITECTURE.md`](ARCHITECTURE.md).\n- For information about the artifact evaluation process for our PLDI 2024 paper,\nplease see [`ARTIFACT_EVALUATION.md`](ARTIFACT_EVALUATION.md).\n\n## Art acknowledgments\n\n- Thanks to [Anna\n    Christenson](https://www.linkedin.com/in/anna-christenson-a51a08213/) for the logo!\n- Thanks to\n  [Patrick Gillespie](http://patorjk.com/)\n  for the\n  [Text to ASCII Art Generator](http://patorjk.com/software/taag)\n  and `myflix` for the \"Sweet\" ASCII art font.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustinlubin%2Fcobbler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjustinlubin%2Fcobbler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustinlubin%2Fcobbler/lists"}