{"id":27057729,"url":"https://github.com/mrange/swift_streams","last_synced_at":"2025-04-05T11:33:01.184Z","repository":{"id":149117063,"uuid":"47493123","full_name":"mrange/swift_streams","owner":"mrange","description":"swift_streams, a functional datapipe that uses `Push` semantics","archived":false,"fork":false,"pushed_at":"2015-12-06T19:53:30.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T02:09:05.631Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrange.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}},"created_at":"2015-12-06T10:57:10.000Z","updated_at":"2015-12-06T12:38:38.000Z","dependencies_parsed_at":"2023-04-15T02:31:04.410Z","dependency_job_id":null,"html_url":"https://github.com/mrange/swift_streams","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/mrange%2Fswift_streams","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrange%2Fswift_streams/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrange%2Fswift_streams/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrange%2Fswift_streams/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrange","download_url":"https://codeload.github.com/mrange/swift_streams/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247331782,"owners_count":20921844,"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":"2025-04-05T11:32:53.613Z","updated_at":"2025-04-05T11:33:01.167Z","avatar_url":"https://github.com/mrange.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Streams for Swift\n\nStreams is a functional data pipeline library that uses `Push` semantics, it is used like this:\n\n```\nlet a : [Int] =\n  from_range (1...10000000)\n  |\u003e skip (10)\n  |\u003e filter { $0 % 2 == 0 }\n  |\u003e take (10)\n  |\u003e map { $0 + 1 }\n  |\u003e to_array ()\n\nprint (\"Array \\(a)\")\n```\n\nPush pipelines often has performance benefits over pull (lazy) because: \n\n1. The code that drives the push pipeline is a for loop `for x in xs`. For loops in most languages is the most efficient way to iterate over collection.\n1. Minimizes end-of-stream checks to the loop that drives the pipeline (refined push pipelines detects if the pipelines will always iterate to the end and in those cases uses a specialized code path without end-of-stream checks)\n\nThen of course there's the question how efficient `Push` streams can be implemented in Swift. Can Swift (like C++) inline the closures or do we end up with \"unnecessary\" closure objects? This is one of the motivations for this library, to investigate how to write efficient functional  libraries in Swift.\n\nThis library is inspired by the [F# Streams](http://nessos.github.io/Streams/) which in turn was inpired by Java 8 Streams.\n\nPush pipelines have drawbacks compared to pull pipelines\n\n1. Once started they will run to the end (F# Streams manages this by introducing a more complex pipeline definition)\n2. Certain operators such as `order_by/then_by` are difficult to implement\n\nTODO\n====\n\n1. Extend the `test_suite`\n2. Implement the most obvious pipeline operators\n3. Package `swift_streams` in a way that's easily consumable\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrange%2Fswift_streams","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrange%2Fswift_streams","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrange%2Fswift_streams/lists"}