{"id":16574200,"url":"https://github.com/zhukovgreen/friendly-sequences","last_synced_at":"2025-10-30T22:36:07.180Z","repository":{"id":233026545,"uuid":"785840703","full_name":"zhukovgreen/friendly-sequences","owner":"zhukovgreen","description":"Friendly, Scala like, Sequence interface","archived":false,"fork":false,"pushed_at":"2025-09-08T16:41:31.000Z","size":61,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-10T08:38:32.305Z","etag":null,"topics":["functional-programming","immutable","mypy","python","static-code-analysis"],"latest_commit_sha":null,"homepage":"","language":"Python","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/zhukovgreen.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2024-04-12T18:29:28.000Z","updated_at":"2025-09-08T16:40:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"a122ae23-d7d6-4b3e-bdf7-1b897869d9f3","html_url":"https://github.com/zhukovgreen/friendly-sequences","commit_stats":null,"previous_names":["zhukovgreen/friendly-sequences"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/zhukovgreen/friendly-sequences","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhukovgreen%2Ffriendly-sequences","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhukovgreen%2Ffriendly-sequences/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhukovgreen%2Ffriendly-sequences/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhukovgreen%2Ffriendly-sequences/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhukovgreen","download_url":"https://codeload.github.com/zhukovgreen/friendly-sequences/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhukovgreen%2Ffriendly-sequences/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281896593,"owners_count":26580137,"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","status":"online","status_checked_at":"2025-10-30T02:00:06.501Z","response_time":61,"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":["functional-programming","immutable","mypy","python","static-code-analysis"],"created_at":"2024-10-11T21:43:59.658Z","updated_at":"2025-10-30T22:36:07.151Z","avatar_url":"https://github.com/zhukovgreen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Friendly Sequences\n\nInspired by Scala Sequence class [1] and iterchain [2],\nbut with a good typing support.\n\n[1] https://alvinalexander.com/scala/seq-class-methods-examples-syntax/\n[2] https://github.com/Evelyn-H/iterchain\n\n## Motivation\n\nIt is possible to compose functions in python with many functional\nprogramming primitives, like map, filter, reduce etc. But, in my opinion,\nlooks a bit ugly and you need to get use to this structure. For example, you\ncan write something like this:\n\n```python\nimport itertools\n\nfrom functools import reduce\n\nassert (\n    reduce(\n        lambda left, right: f\"{left}{right}\",\n        map(\n            str,\n            sorted(\n                filter(\n                    lambda x: x != 2,\n                    map(\n                        lambda x: x + 1,\n                        itertools.chain.from_iterable(\n                            zip(\n                                (1, 2),\n                                (3, 4),\n                            )\n                        ),\n                    ),\n                )\n            ),\n        ),\n        \"\",\n    )\n    == \"345\"\n)\n```\n\nor even this:\n\n```python\nimport itertools\n\nassert (\n    \"\".join(\n        sorted(\n            str(x)\n            for x in (\n                x\n                for x in (\n                    x + 1\n                    for x in itertools.chain.from_iterable(\n                        zip(\n                            (1, 2),\n                            (3, 4),\n                        )\n                    )\n                )\n                if x != 2\n            )\n        )\n    )\n    == \"345\"\n)\n```\n\nbut with the friendly-sequences it is just this:\n\n```python\nfrom friendly_sequences import Seq\n\nassert (\n    Seq[int]((1, 2))\n    .zip(Seq[int]((3, 4)))\n    .flat_map(lambda x: x + 1)\n    .filter(lambda x: x != 2)\n    .sort()\n    .map(str)\n    .fold(lambda left, right: f\"{left}{right}\", \"\")\n) == \"345\"\n```\n\n## Installation\n\n```bash\n$ pip install friendly-sequences\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhukovgreen%2Ffriendly-sequences","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhukovgreen%2Ffriendly-sequences","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhukovgreen%2Ffriendly-sequences/lists"}