{"id":26227862,"url":"https://github.com/benji6/church","last_synced_at":"2025-04-04T11:16:40.168Z","repository":{"id":38290768,"uuid":"47869297","full_name":"benji6/church","owner":"benji6","description":":church: Church Encoding in JS","archived":false,"fork":false,"pushed_at":"2025-03-02T09:12:47.000Z","size":1403,"stargazers_count":127,"open_issues_count":0,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T10:06:43.561Z","etag":null,"topics":["church-encoding","combinatory-logic","functional-programming","haskell","lambda-calculus"],"latest_commit_sha":null,"homepage":"http://benji6.github.io/church/docs","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benji6.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2015-12-12T07:39:36.000Z","updated_at":"2025-03-02T09:12:43.000Z","dependencies_parsed_at":"2023-10-02T12:40:20.226Z","dependency_job_id":"bb31739e-adab-4f47-93eb-b0b287534496","html_url":"https://github.com/benji6/church","commit_stats":{"total_commits":242,"total_committers":6,"mean_commits":"40.333333333333336","dds":0.6363636363636364,"last_synced_commit":"00c30c5e1a31f6ed2d1a1a7b2e622ceb05784f30"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benji6%2Fchurch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benji6%2Fchurch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benji6%2Fchurch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benji6%2Fchurch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benji6","download_url":"https://codeload.github.com/benji6/church/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247166169,"owners_count":20894654,"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":["church-encoding","combinatory-logic","functional-programming","haskell","lambda-calculus"],"created_at":"2025-03-12T20:20:13.615Z","updated_at":"2025-04-04T11:16:40.151Z","avatar_url":"https://github.com/benji6.png","language":"JavaScript","funding_links":[],"categories":["Javascript"],"sub_categories":[],"readme":"# church\n\n[![npm version](https://badge.fury.io/js/church.svg)](https://badge.fury.io/js/church)\n![CI](https://github.com/benji6/church/workflows/CI/badge.svg)\n\nChurch encoding utility library for JavaScript\n\n## Why?\n\nI built this library mostly as a learning exercise, but the code is also available as an npm module that can be consumed and used to build JavaScript applications using basically nothing but functions. I'm not sure why you would want to do that though!\n\n## What?\n\nChurch encoding is a way of encoding data using only functions. For instance, we can use functions to represent, booleans, numerals and lists. Higher-order functions are all you need for Turing completeness.\n\n## How?\n\nCheck out the [docs](http://benji6.github.io/church/docs/).\n\n### Install\n\n`npm i church` or `yarn add church`.\n\n### Examples\n\n```javascript\nimport {\n  decodeList,\n  decodeNumeral,\n  encodeList,\n  encodeNumeral,\n  five,\n  If,\n  lt,\n  map,\n  mult,\n  one,\n  range,\n  three,\n  two,\n} from 'church'\n\nconst twoFourSix = map(mult(two))(range(one)(three))\n// =\u003e Church encoded list of [two four six]\n\nconst twoFourSixJs = decodeList(twoFourSix).map(decodeNumeral)\n// =\u003e [2, 4, 6] (standard JS array of standard JS numbers)\n\nencodeList(twoFourSixJs.map(encodeNumeral))\n// =\u003e Church encoded list of [two four six] again\n\nmap(x =\u003e If(lt(x)(five))(five)(x))(twoFourSix)\n// =\u003e Church encoded list of [five five six]\n```\n\n### Resources\n\n- [combinators-js](https://github.com/benji6/combinators-js) - a library of combinators in JS I wrote\n- [http://raganwald.com/2015/02/13/functional-quantum-electrodynamics.html](http://raganwald.com/2015/02/13/functional-quantum-electrodynamics.html) - totally mind-blowing article, this repo probably would not exist if I hadn't read it\n- [https://en.wikipedia.org/wiki/Church_encoding](https://en.wikipedia.org/wiki/Church_encoding)\n- [http://dictionary.sensagent.com/Church%20encoding/en-en/](http://dictionary.sensagent.com/Church%20encoding/en-en/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenji6%2Fchurch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenji6%2Fchurch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenji6%2Fchurch/lists"}