{"action":"created","issue":{"url":"https://api.github.com/repos/mostjs/core/issues/152","repository_url":"https://api.github.com/repos/mostjs/core","labels_url":"https://api.github.com/repos/mostjs/core/issues/152/labels{/name}","comments_url":"https://api.github.com/repos/mostjs/core/issues/152/comments","events_url":"https://api.github.com/repos/mostjs/core/issues/152/events","html_url":"https://github.com/mostjs/core/issues/152","id":264074774,"number":152,"title":"Return empty() when possible","user":{"login":"briancavalier","id":90518,"avatar_url":"https://avatars2.githubusercontent.com/u/90518?v=4","gravatar_id":"","url":"https://api.github.com/users/briancavalier","html_url":"https://github.com/briancavalier","followers_url":"https://api.github.com/users/briancavalier/followers","following_url":"https://api.github.com/users/briancavalier/following{/other_user}","gists_url":"https://api.github.com/users/briancavalier/gists{/gist_id}","starred_url":"https://api.github.com/users/briancavalier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/briancavalier/subscriptions","organizations_url":"https://api.github.com/users/briancavalier/orgs","repos_url":"https://api.github.com/users/briancavalier/repos","events_url":"https://api.github.com/users/briancavalier/events{/privacy}","received_events_url":"https://api.github.com/users/briancavalier/received_events","type":"User","site_admin":false},"labels":[{"id":506095470,"url":"https://api.github.com/repos/mostjs/core/labels/Type:%20Feature","name":"Type: Feature","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-10-10T01:53:12Z","updated_at":"2017-11-20T18:19:55Z","closed_at":null,"author_association":"OWNER","body":"See #150 \r\n\r\nThere quite a few operations where if at least one input stream is empty(), the operation will always return a stream containing zero events. In such cases, some operations return the canonical empty(), and some don't.\r\n\r\nIt might be interesting to always return the canonical empty() in those cases. That would allow empty() to annihilate other operations more effectively. It trades some up-front cost for reduction in cpu and memory later when a stream is observed.\r\n\r\n### Operations that could return empty()\r\n\r\n* [ ] `map`\r\n* [ ] `filter`\r\n* [ ] `ap`\r\n* [ ] `loop`\r\n* [ ] `withItems` & `zipItems`\r\n* [ ] `zip` & `zipArray`\r\n* [ ] `mergeMapConcurrently`, and thus `join`, `chain`, and `concatMap`\r\n* [ ] `skipRepeats` & `skipRepeatsWith`\r\n* [ ] `slice`, `take`, `skip`\r\n* [ ] `takeWhile`\r\n* [ ] `skipWhile`\r\n* [ ] `skipAfter`\r\n* [ ] `withLocalTime`\r\n* [ ] `awaitPromises`\r\n* [ ] `switchLatest`\r\n* [ ] `throttle`\r\n* [ ] `debounce`\r\n* [ ] `merge(empty(), empty())` and `mergeArray` when all streams are `empty()`\r\n* [ ] `recoverWith(f, empty())`\r\n* [ ] `multicast`\r\n\r\n### Operations that need more discussion\r\n\r\n* [ ] `delay` - What is the _meaning_ of `delay(n, empty())`, especially wrt end?\r\n"},"comment":{"url":"https://api.github.com/repos/mostjs/core/issues/comments/345782784","html_url":"https://github.com/mostjs/core/issues/152#issuecomment-345782784","issue_url":"https://api.github.com/repos/mostjs/core/issues/152","id":345782784,"user":{"login":"briancavalier","id":90518,"avatar_url":"https://avatars2.githubusercontent.com/u/90518?v=4","gravatar_id":"","url":"https://api.github.com/users/briancavalier","html_url":"https://github.com/briancavalier","followers_url":"https://api.github.com/users/briancavalier/followers","following_url":"https://api.github.com/users/briancavalier/following{/other_user}","gists_url":"https://api.github.com/users/briancavalier/gists{/gist_id}","starred_url":"https://api.github.com/users/briancavalier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/briancavalier/subscriptions","organizations_url":"https://api.github.com/users/briancavalier/orgs","repos_url":"https://api.github.com/users/briancavalier/repos","events_url":"https://api.github.com/users/briancavalier/events{/privacy}","received_events_url":"https://api.github.com/users/briancavalier/received_events","type":"User","site_admin":false},"created_at":"2017-11-20T18:19:55Z","updated_at":"2017-11-20T18:19:55Z","author_association":"OWNER","body":"> Couldn't mergeArray filter all streams out that are empty() ?\r\n\r\nYep, and I think it should.  The natural extension of that is that if mergeArray ends up with an array of length zero after filtering out canonically empty streams, it should itself return a canonically empty stream.  When taken together with the fact that mergeArray already recursively flattens nested merge streams it encounters, mergeArray will be able to annihilate recursively."}}
{"actor":{"display_login":"briancavalier"}}