{"id":15475820,"url":"https://github.com/mooreniemi/proc_compose","last_synced_at":"2025-07-02T14:37:46.229Z","repository":{"id":56888816,"uuid":"69827994","full_name":"mooreniemi/proc_compose","owner":"mooreniemi","description":":musical_score: Proc#compose","archived":false,"fork":false,"pushed_at":"2016-10-03T00:53:14.000Z","size":25,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-24T14:58:43.330Z","etag":null,"topics":["c","c-extension","compose","functional-programming","gem","ruby"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/mooreniemi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-02T23:26:15.000Z","updated_at":"2016-10-02T23:26:28.000Z","dependencies_parsed_at":"2022-08-20T15:20:50.037Z","dependency_job_id":null,"html_url":"https://github.com/mooreniemi/proc_compose","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/mooreniemi%2Fproc_compose","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mooreniemi%2Fproc_compose/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mooreniemi%2Fproc_compose/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mooreniemi%2Fproc_compose/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mooreniemi","download_url":"https://codeload.github.com/mooreniemi/proc_compose/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246036179,"owners_count":20713205,"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":["c","c-extension","compose","functional-programming","gem","ruby"],"created_at":"2024-10-02T03:20:32.581Z","updated_at":"2025-03-28T13:26:27.052Z","avatar_url":"https://github.com/mooreniemi.png","language":"Ruby","readme":"```\n\n ___|)___________________________________________________________\n|___/____________________________________________________________\n|__/|____________________________________________________________\n|_/(|,\\__________________________________________________________\n|_\\_|_/__________________________________________________________\n|   |\n| (_|\n|\n|________________________________________________________________\n|__/___\\_._______________________________________________________\n|__\\___|_._______________________________________________________\n|_____/__________________________________________________________\n|____/___________________________________________________________ ejm\n\n```\n\n# Proc#compose\n\nThis gem does just one thing: it adds `compose` to `Proc`, with the alias `*`. Based on [this experiment](https://github.com/mooreniemi/compose). It performs just a _little_ worse than chaining `map`'d blocks, and currently does **not** [preserve lambdas](http://culttt.com/2015/05/13/what-are-lambdas-in-ruby/) ([they are coerced into `Proc`](spec/proc_compose_spec.rb#L35)).\n\n![performance graph of Proc#compose](proc_compose_performance.gif)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'proc_compose'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install proc_compose\n\n## Usage\n\nFirst things first:\n\n```ruby\nrequire 'proc_compose'\n```\n\nNow, given two [Proc](https://ruby-doc.org/core-2.2.0/Proc.html) objects, say:\n\n```ruby\ndouble = proc {|a| a * 2 }\ntriple = proc {|a| a * 3 }\n```\n\nWe can compose them:\n\n```ruby\n(double * triple).(2)\n=\u003e 12\n```\n\nSo you can do things like this:\n\n```ruby\n[1, 2, 3, 4, 5].map(\u0026(double * triple))\n=\u003e [6, 12, 18, 24, 30]\n```\n\nNeat!\n\n## Alternatives\n\nYou can write your [own version in Ruby](http://mooreniemi.github.io/2016/09/18/combinators.html), or use [funkify](https://github.com/banister/funkify). Though its [performance is worse](https://github.com/mooreniemi/experiments/blob/master/lib/funkify.rb) it is pure Ruby and you get some really nice other stuff like `\u003e=` and `|`!\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/mooreniemi/proc_compose. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmooreniemi%2Fproc_compose","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmooreniemi%2Fproc_compose","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmooreniemi%2Fproc_compose/lists"}