{"id":15991931,"url":"https://github.com/antonlydike/functionalshell","last_synced_at":"2025-04-04T23:22:15.756Z","repository":{"id":133508258,"uuid":"339735274","full_name":"AntonLydike/functionalshell","owner":"AntonLydike","description":"some common helpers in functional programming to help you do more with your shell","archived":false,"fork":false,"pushed_at":"2021-02-17T13:52:45.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-10T07:43:43.386Z","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/AntonLydike.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":"2021-02-17T13:38:41.000Z","updated_at":"2021-02-17T13:52:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"23cb5950-1b9b-4515-88b3-d50e837f1261","html_url":"https://github.com/AntonLydike/functionalshell","commit_stats":{"total_commits":2,"total_committers":1,"mean_commits":2.0,"dds":0.0,"last_synced_commit":"6e23587b817d271a0673a0d5c809c3006d403639"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AntonLydike%2Ffunctionalshell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AntonLydike%2Ffunctionalshell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AntonLydike%2Ffunctionalshell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AntonLydike%2Ffunctionalshell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AntonLydike","download_url":"https://codeload.github.com/AntonLydike/functionalshell/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247262765,"owners_count":20910303,"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":[],"created_at":"2024-10-08T06:04:20.964Z","updated_at":"2025-04-04T23:22:15.737Z","avatar_url":"https://github.com/AntonLydike.png","language":"Shell","readme":"# functional programming for shell scripts\n\nThis tool aims to provide functional programming basics like map, reduce, fold, zip etc for shells\n\nExample: `du * | cut -f 1 | reduce (lambda x y : 'math $y + $x')` here we sum over all file sizes using a lambda and the reduce function.\n\n\n## install\n### fish:\ninclude `set -ax fish_function_path /path/to/this/repo/src/fish` somewhere in your fish init\n\n## Available functions:\n`\u003clist\u003e` can is always a list of zero or more arguments\n\n\n### map \nUsage: `map CMD \u003clist\u003e`\n\ncall `FUNCTION $ARG` for each arg supplied\n\n### coalesce\nUsage: `coalesce \u003clist\u003e`\n\nprints first non null argument\n\n### reduce\nUsage: `reduce CMD [--start=\u003cvalue\u003e] \u003clist\u003e`\n\nReduce the list: `x0 = start || \"\"` and `x_n+1 = (CMD $x_n $arg_n)`\n\n### zip\nUsage `zip [--cmd=CMD] \u003clist\u003e [ -- \u003clist\u003e [ -- \u003clist\u003e [...]]]`\n\n`CMD` defaults to `echo`\n\nReturns `CMD $list1_i $list2_i ...` for each entry in the lists. If the list is empty the argument will be an empty string\n\n### lambda\nUsage: `lambda \u003carg1\u003e \u003carg2\u003e ... : \u003cbody\u003e`\n\nExamples: \n```\n# create lambda function and save reference to it\nset add (lambda x y : 'math $y + $x')\n# call it\n$add 1 2\n# use it\nreduce $add (seq 10)\n# immediate usage\nreduce (lambda x y : 'math $y + $x') (seq 10)\n```\n\n### curry\nUsage: `curry cmd \u003clist\u003e`\n\n[curries](https://en.wikipedia.org/wiki/Currying) `cmd` with `list`. ","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonlydike%2Ffunctionalshell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantonlydike%2Ffunctionalshell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonlydike%2Ffunctionalshell/lists"}