{"action":"created","issue":{"url":"https://api.github.com/repos/funkia/hareactive/issues/18","repository_url":"https://api.github.com/repos/funkia/hareactive","labels_url":"https://api.github.com/repos/funkia/hareactive/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/funkia/hareactive/issues/18/comments","events_url":"https://api.github.com/repos/funkia/hareactive/issues/18/events","html_url":"https://github.com/funkia/hareactive/issues/18","id":196272094,"number":18,"title":"Improve documentation","user":{"login":"paldepind","id":521604,"avatar_url":"https://avatars2.githubusercontent.com/u/521604?v=3","gravatar_id":"","url":"https://api.github.com/users/paldepind","html_url":"https://github.com/paldepind","followers_url":"https://api.github.com/users/paldepind/followers","following_url":"https://api.github.com/users/paldepind/following{/other_user}","gists_url":"https://api.github.com/users/paldepind/gists{/gist_id}","starred_url":"https://api.github.com/users/paldepind/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paldepind/subscriptions","organizations_url":"https://api.github.com/users/paldepind/orgs","repos_url":"https://api.github.com/users/paldepind/repos","events_url":"https://api.github.com/users/paldepind/events{/privacy}","received_events_url":"https://api.github.com/users/paldepind/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"paldepind","id":521604,"avatar_url":"https://avatars2.githubusercontent.com/u/521604?v=3","gravatar_id":"","url":"https://api.github.com/users/paldepind","html_url":"https://github.com/paldepind","followers_url":"https://api.github.com/users/paldepind/followers","following_url":"https://api.github.com/users/paldepind/following{/other_user}","gists_url":"https://api.github.com/users/paldepind/gists{/gist_id}","starred_url":"https://api.github.com/users/paldepind/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paldepind/subscriptions","organizations_url":"https://api.github.com/users/paldepind/orgs","repos_url":"https://api.github.com/users/paldepind/repos","events_url":"https://api.github.com/users/paldepind/events{/privacy}","received_events_url":"https://api.github.com/users/paldepind/received_events","type":"User","site_admin":false},"assignees":[{"login":"paldepind","id":521604,"avatar_url":"https://avatars2.githubusercontent.com/u/521604?v=3","gravatar_id":"","url":"https://api.github.com/users/paldepind","html_url":"https://github.com/paldepind","followers_url":"https://api.github.com/users/paldepind/followers","following_url":"https://api.github.com/users/paldepind/following{/other_user}","gists_url":"https://api.github.com/users/paldepind/gists{/gist_id}","starred_url":"https://api.github.com/users/paldepind/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paldepind/subscriptions","organizations_url":"https://api.github.com/users/paldepind/orgs","repos_url":"https://api.github.com/users/paldepind/repos","events_url":"https://api.github.com/users/paldepind/events{/privacy}","received_events_url":"https://api.github.com/users/paldepind/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2016-12-18T12:03:25Z","updated_at":"2017-05-06T10:21:02Z","closed_at":null,"body":"The documentation is currently pretty bad.\r\n\r\nAdd\r\n\r\n- [x] Description of `Stream`\r\n- [x] Description of `Behavior`\r\n- [ ] Description of `Now`\r\n- [ ] Better explanations\n- [ ] Examples\r\n"},"comment":{"url":"https://api.github.com/repos/funkia/hareactive/issues/comments/299630206","html_url":"https://github.com/funkia/hareactive/issues/18#issuecomment-299630206","issue_url":"https://api.github.com/repos/funkia/hareactive/issues/18","id":299630206,"user":{"login":"paldepind","id":521604,"avatar_url":"https://avatars2.githubusercontent.com/u/521604?v=3","gravatar_id":"","url":"https://api.github.com/users/paldepind","html_url":"https://github.com/paldepind","followers_url":"https://api.github.com/users/paldepind/followers","following_url":"https://api.github.com/users/paldepind/following{/other_user}","gists_url":"https://api.github.com/users/paldepind/gists{/gist_id}","starred_url":"https://api.github.com/users/paldepind/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paldepind/subscriptions","organizations_url":"https://api.github.com/users/paldepind/orgs","repos_url":"https://api.github.com/users/paldepind/repos","events_url":"https://api.github.com/users/paldepind/events{/privacy}","received_events_url":"https://api.github.com/users/paldepind/received_events","type":"User","site_admin":false},"created_at":"2017-05-06T10:21:02Z","updated_at":"2017-05-06T10:21:02Z","body":"You have definitely made a lot of really good observations! :smile:\r\n\r\n> It would be nice to give motivation with good examples for each concept or just provide a link.\r\n\r\nI agree. The documentation is rather abstract as of now :sob: \r\n\r\n> Does it still apply to a live stream? With list we usually know all the values and can evaluate its length. But how can we evaluate the stream length if that can change?\r\n\r\nConceptually it does. In theory, we could know all past and future occurrences and represent them as a list. But in practice, we can't really do that.\r\n\r\n> What about the other combinations - apply Stream to Behavior and Behavior to Behavior?\r\n\r\nI can't see how applying a stream to a behaviour makes sense. But for applying a behavior to a behavior there is the `ap` method on behaviors. It's unfortunately not in the documentation yet.\r\n\r\n> Can `filter` be possibly derived from a more general partial `reduce`, like the normal `filter`? \r\n\r\nNo. And strictly speaking the normal `filter` can't be derived from only `reduce` either. `reduce` gives a way to take structure apart. To implement `filter` you also need a way to assemble a new structure (like `concat` or `cons`).\r\n\r\n> Also here? That way there are fewer basic methods and others would be derived.\r\n\r\nYes. Definetly. `split` is just implemented like this:\r\n\r\n```ts\r\nexport function split<A>(predicate: (a: A) => boolean, stream: Stream<A>): [Stream<A>, Stream<A>] {\r\n  return [stream.filter(predicate), stream.filter((a) => !predicate(a))];\r\n}\r\n```\r\n\r\n> Another partial reduce, of which `filter` is special case for the constant behavior? \r\n\r\nYes. That is spot on.\r\n\r\n> That seems derived from applying the identity and filtering thereafter.\r\n\r\nI hadn't thought of that. But I think you are right :+1: \r\n\r\n> Not sure I understand this. Is that just like map into the identity?\r\n\r\nSemantically `snapshot` works like this:\r\n\r\n```js\r\nfunction snapshot(behavior, stream) {\r\n  return stream.map(({time}) => ({time, value: behavior(time)}));\r\n}\r\n```\r\n\r\nFor each occurrence in the stream we ask the behavior \"what is your value right now?\". And then a new stream is returned where the values in the first stream is replaced by the behavior's value at those points in time.\r\n\r\n> Haven't looked at the others, but would be good to try keep the number of methods as small as possible or make some good hierarchy. Otherwise, people may get scared away thinking of another RxJS :)\r\n\r\nYes. That is definitely a good idea. How do you think we should do that? Should we have a list of \"essential\" combinators and a list of \"extra\" combinators?"}}
{"actor":{"display_login":"paldepind"}}