{"action":"created","issue":{"url":"https://api.github.com/repos/lodash/lodash/issues/4125","repository_url":"https://api.github.com/repos/lodash/lodash","labels_url":"https://api.github.com/repos/lodash/lodash/issues/4125/labels{/name}","comments_url":"https://api.github.com/repos/lodash/lodash/issues/4125/comments","events_url":"https://api.github.com/repos/lodash/lodash/issues/4125/events","html_url":"https://github.com/lodash/lodash/issues/4125","id":391759244,"node_id":"MDU6SXNzdWUzOTE3NTkyNDQ=","number":4125,"title":"Giving reduce() a function as an initial value","user":{"login":"insonifi","id":3122135,"node_id":"MDQ6VXNlcjMxMjIxMzU=","avatar_url":"https://avatars1.githubusercontent.com/u/3122135?v=4","gravatar_id":"","url":"https://api.github.com/users/insonifi","html_url":"https://github.com/insonifi","followers_url":"https://api.github.com/users/insonifi/followers","following_url":"https://api.github.com/users/insonifi/following{/other_user}","gists_url":"https://api.github.com/users/insonifi/gists{/gist_id}","starred_url":"https://api.github.com/users/insonifi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/insonifi/subscriptions","organizations_url":"https://api.github.com/users/insonifi/orgs","repos_url":"https://api.github.com/users/insonifi/repos","events_url":"https://api.github.com/users/insonifi/events{/privacy}","received_events_url":"https://api.github.com/users/insonifi/received_events","type":"User","site_admin":false},"labels":[{"id":2763156,"node_id":"MDU6TGFiZWwyNzYzMTU2","url":"https://api.github.com/repos/lodash/lodash/labels/question","name":"question","color":"d4c5f9","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-12-17T15:19:50Z","updated_at":"2018-12-17T20:21:15Z","closed_at":"2018-12-17T15:36:07Z","author_association":"NONE","body":"I am wondering for long time, but haven't found any answer on the web. Why lodash `reduce()` doesn't accept stub-functions as an initial value?\r\nI see very natural to do something like this:\r\n```\r\nconst stubState = () => ({avg: 0, count: 0});\r\nconst countedAvg = reduce(\r\n    (state, {value}) => ({\r\n        avg: (state.avg + value) / 2,\r\n        count: state.count + 1\r\n    }),\r\n    stubState\r\n);\r\n\r\ncountedAvg(samples);\r\n```\r\nhttps://runkit.com/insonifi/5c17bc61317a9a001575595f\r\n\r\nAnd yet, it doesn't recognize it work. Can it be useful?"},"comment":{"url":"https://api.github.com/repos/lodash/lodash/issues/comments/447985127","html_url":"https://github.com/lodash/lodash/issues/4125#issuecomment-447985127","issue_url":"https://api.github.com/repos/lodash/lodash/issues/4125","id":447985127,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0Nzk4NTEyNw==","user":{"login":"StreetStrider","id":2124761,"node_id":"MDQ6VXNlcjIxMjQ3NjE=","avatar_url":"https://avatars3.githubusercontent.com/u/2124761?v=4","gravatar_id":"","url":"https://api.github.com/users/StreetStrider","html_url":"https://github.com/StreetStrider","followers_url":"https://api.github.com/users/StreetStrider/followers","following_url":"https://api.github.com/users/StreetStrider/following{/other_user}","gists_url":"https://api.github.com/users/StreetStrider/gists{/gist_id}","starred_url":"https://api.github.com/users/StreetStrider/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StreetStrider/subscriptions","organizations_url":"https://api.github.com/users/StreetStrider/orgs","repos_url":"https://api.github.com/users/StreetStrider/repos","events_url":"https://api.github.com/users/StreetStrider/events{/privacy}","received_events_url":"https://api.github.com/users/StreetStrider/received_events","type":"User","site_admin":false},"created_at":"2018-12-17T20:21:15Z","updated_at":"2018-12-17T20:21:15Z","author_association":"CONTRIBUTOR","body":"@insonifi :thinking: if do so, how to distinguish function as initializer from function as value? If do your change, all values must be wrapped in `constant(value)` as a consequence."}}
{"actor":{"display_login":"StreetStrider"}}