{"action":"created","issue":{"url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/3837","labels_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/3837/labels{/name}","comments_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/3837/comments","events_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/3837/events","html_url":"https://github.com/D-Programming-Language/phobos/pull/3837","id":118964204,"number":3837,"title":"Improve std.algorithm.iteration.each","user":{"login":"rcorre","id":2496231,"avatar_url":"https://avatars.githubusercontent.com/u/2496231?v=3","gravatar_id":"","url":"https://api.github.com/users/rcorre","html_url":"https://github.com/rcorre","followers_url":"https://api.github.com/users/rcorre/followers","following_url":"https://api.github.com/users/rcorre/following{/other_user}","gists_url":"https://api.github.com/users/rcorre/gists{/gist_id}","starred_url":"https://api.github.com/users/rcorre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rcorre/subscriptions","organizations_url":"https://api.github.com/users/rcorre/orgs","repos_url":"https://api.github.com/users/rcorre/repos","events_url":"https://api.github.com/users/rcorre/events{/privacy}","received_events_url":"https://api.github.com/users/rcorre/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-11-26T03:23:09Z","updated_at":"2015-12-14T13:38:43Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/3837","html_url":"https://github.com/D-Programming-Language/phobos/pull/3837","diff_url":"https://github.com/D-Programming-Language/phobos/pull/3837.diff","patch_url":"https://github.com/D-Programming-Language/phobos/pull/3837.patch"},"body":"This addresses some concerns/confusion brought up in [this SO question](http://stackoverflow.com/questions/33779822/unable-to-call-each-on-a-lockstep-range-containing-2-or-more-ranges).\r\n\r\nThe first is that `each` will accept a 2-arg lambda, but assumes that the first is for an index and doesn't pass by ref. This means that if you try to pass two args by ref (e.g. using `lockstep`), one will not reference the source.\r\n\r\nThe second is that `each` cannot iterate with an arbitrary number of variables (e.g. iterating over a range produced via `lockstep`/`zip` with >2 args). This adds support for such a scenario, but is a bit messy (involving a mixed-in generated foreach loop), and doesn't work for a templated `opApply` (cannot determine the arity).\r\n\r\nI can break apart the PR if people like the first (simple) fix but feel that the latter is too complicated for a somewhat edge-case-y scenario."},"comment":{"url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/comments/164440677","html_url":"https://github.com/D-Programming-Language/phobos/pull/3837#issuecomment-164440677","issue_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/3837","id":164440677,"user":{"login":"rcorre","id":2496231,"avatar_url":"https://avatars.githubusercontent.com/u/2496231?v=3","gravatar_id":"","url":"https://api.github.com/users/rcorre","html_url":"https://github.com/rcorre","followers_url":"https://api.github.com/users/rcorre/followers","following_url":"https://api.github.com/users/rcorre/following{/other_user}","gists_url":"https://api.github.com/users/rcorre/gists{/gist_id}","starred_url":"https://api.github.com/users/rcorre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rcorre/subscriptions","organizations_url":"https://api.github.com/users/rcorre/orgs","repos_url":"https://api.github.com/users/rcorre/repos","events_url":"https://api.github.com/users/rcorre/events{/privacy}","received_events_url":"https://api.github.com/users/rcorre/received_events","type":"User","site_admin":false},"created_at":"2015-12-14T13:38:43Z","updated_at":"2015-12-14T13:38:43Z","body":"> Perhaps a solution that calls opApply directly would be better.\r\n\r\nI think that would be cleaner. I'll give it a try this week."}}