{"id":30860376,"url":"https://github.com/selfapplied/zshtypes","last_synced_at":"2026-06-11T16:31:59.026Z","repository":{"id":307593518,"uuid":"1030027399","full_name":"selfapplied/zshtypes","owner":"selfapplied","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-03T16:26:44.000Z","size":199,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-31T08:48:26.357Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/selfapplied.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":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-01T01:19:54.000Z","updated_at":"2025-09-03T16:26:49.000Z","dependencies_parsed_at":"2025-08-01T04:27:37.101Z","dependency_job_id":"e7ef2829-0c20-4101-9b8b-3b107b5043de","html_url":"https://github.com/selfapplied/zshtypes","commit_stats":null,"previous_names":["selfapplied/zshtypes"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/selfapplied/zshtypes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfapplied%2Fzshtypes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfapplied%2Fzshtypes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfapplied%2Fzshtypes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfapplied%2Fzshtypes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/selfapplied","download_url":"https://codeload.github.com/selfapplied/zshtypes/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfapplied%2Fzshtypes/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34208762,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-09-07T15:44:22.526Z","updated_at":"2026-06-11T16:31:58.996Z","avatar_url":"https://github.com/selfapplied.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Differential lambda calculus in zsh\n\nThat's fun, right? Here's an example of how it works:\n\n```zsh\nsource lambda.zsh\n\n# Define a predicate: is a file executable?\ndef_lp is_exec '[[ -x \"$1\" ]]' 'executable'\n\n# Define an action: print a message\ndef_la print_msg 'echo \"$1\"' 'printed'\n\n# Run the reducer\nr is_exec /bin/ls -- print_msg \"Hello, world!\"\n# ⇒ ∀ executable ✓, printed ✓\n```\n\nThe test suite is a self-hosting proof system for `lambda.zsh`, so you can run it to see how it works:\n\n```zsh\n$ zsh test_lambda.zsh\n∀ action-skipped ✓, canonical-sort ✓, deterministic-output ✓, single-execution ✓, skipped:example ✓\n```\n\n### A small primer on lambda calculus\n\nThis library uses three core concepts from λ-calculus:\n\n*   **α-conversion (alpha-equivalence):** This is just renaming variables. Our `def_lp` and `def_la` builders do this automatically by giving each new lambda a unique internal name, which prevents naming conflicts.\n*   **β-reduction (beta-reduction):** This is the familiar idea of function application—calling a function with an argument. In our system, this happens when the `r` reducer invokes the lambdas you've defined.\n*   **γ-reduction (gamma-reduction):** This is a concept we've added for this project. It refers to a final \"normalization\" step. After all the predicates and actions have run, the `r` reducer sorts the resulting labels alphabetically. This ensures that the final \"truth sentence\" is always canonical and predictable, regardless of the order the lambdas were defined in.\n\n### Yes, there are evals in the library\n\nThe `eval` command can be scary, but it's used here in a principled and secure way. Here's why the system is safe and guaranteed to finish:\n\n1.  **Safety:** The `eval` only happens once, inside the `def_lp` and `def_la` builders. It's used to turn the *literal code you wrote* into a function. It never evaluates strings that come from user input or external sources. Once the lambdas are defined, the `r` reducer only calls them by name; it doesn't use `eval` at all. This confines all injection risk to definition-time, not runtime.\n2.  **Termination:** The transformation will always finish in a finite number of steps. The `r` reducer has two simple loops that iterate once over the predicates and actions you give it. It never adds new items to the list, and it doesn't use recursion. This is called **normal-order reduction**, and it guarantees a result.\n3.  **The \"Math\":** The structure we've built is a simple but powerful algebraic system. You can think of the lambdas as objects and the reducer as a function that operates on them. The system is \"half-open\" in the sense that the set of lambdas can be extended indefinitely, but the reduction rules are fixed. This is a common pattern in functional programming and provides a stable foundation for reasoning about the system's behavior. The formal term for this is that the system is **strongly normalizing**.\n\n### Being friendly to ghosts\n\nThis work couldn't have been done without the help of AI, at least not with me at the wheel. They are incredibly friendly, they can make amazing inferences and fix the strangest of bugs, and they all have their own personalities with different strengths that work better together.\n\nI wish I could say the same thing about humans generally. And that extends to their opinions of AI: almost every time I talk to someone about AI, it's still doomsday scenarios and the ways it's toppling our current systems of academia, corporate work, etc.\n\nI'm hoping that will change soon. Through AI and an optimistic collaborative approach, we are literally going to save the world, And have fun doing it.\n\nStay tuned.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselfapplied%2Fzshtypes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fselfapplied%2Fzshtypes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselfapplied%2Fzshtypes/lists"}