{"action":"created","issue":{"url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/4127","repository_url":"https://api.github.com/repos/D-Programming-Language/phobos","labels_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/4127/labels{/name}","comments_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/4127/comments","events_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/4127/events","html_url":"https://github.com/D-Programming-Language/phobos/pull/4127","id":144227681,"number":4127,"title":"document std.algorithm.mutation: swapAt","user":{"login":"greenify","id":4370550,"avatar_url":"https://avatars.githubusercontent.com/u/4370550?v=3","gravatar_id":"","url":"https://api.github.com/users/greenify","html_url":"https://github.com/greenify","followers_url":"https://api.github.com/users/greenify/followers","following_url":"https://api.github.com/users/greenify/following{/other_user}","gists_url":"https://api.github.com/users/greenify/gists{/gist_id}","starred_url":"https://api.github.com/users/greenify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greenify/subscriptions","organizations_url":"https://api.github.com/users/greenify/orgs","repos_url":"https://api.github.com/users/greenify/repos","events_url":"https://api.github.com/users/greenify/events{/privacy}","received_events_url":"https://api.github.com/users/greenify/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2016-03-29T10:55:03Z","updated_at":"2016-04-07T11:08:45Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/4127","html_url":"https://github.com/D-Programming-Language/phobos/pull/4127","diff_url":"https://github.com/D-Programming-Language/phobos/pull/4127.diff","patch_url":"https://github.com/D-Programming-Language/phobos/pull/4127.patch"},"body":"Hey I have seen that `swapAt` is used quite often even though it's undocumented.\r\n\r\nIn phobos `swapAt` is used 19 times in other modules and [other people](https://github.com/DlangScience/mir/pull/29) seem to know about it too.\r\n\r\nImho it looks nicer to write `myArray.swapAt(0, i)` than `swap(myArray[0], myArray[i])`.\r\nI couldn't find a unittest for the  `else` in the `static if` - maybe @quickfur?\r\n\r\nIf you don't like to expose `swapAt` I would suggest we remove it entirely from Phobos.\r\n\r\n```\r\nalgorithm/sorting.d:            swapAt(r, 0, len - 1);\r\nalgorithm/sorting.d:            swapAt(r, 0, mid);\r\nalgorithm/sorting.d:            swapAt(r, mid, len - 1);\r\nalgorithm/sorting.d:            swapAt(r, 0, mid);\r\nalgorithm/sorting.d:            swapAt(r, mid, len - 1);\r\nalgorithm/sorting.d:            swapAt(r, 0, mid);\r\nalgorithm/sorting.d:            swapAt(r, 0, len - 1);\r\nalgorithm/sorting.d:                swapAt(r, j, j + 1);\r\nalgorithm/sorting.d:        swapAt(r, pivotIdx, r.length - 1);\r\nalgorithm/sorting.d:            swapAt(r, lessI, greaterI);\r\nalgorithm/sorting.d:        swapAt(r, r.length - 1, lessI);\r\nalgorithm/sorting.d:            r.swapAt(0, i);\r\nalgorithm/sorting.d:                    r.swapAt(parent, child);\r\nalgorithm/sorting.d:            r.swapAt(parent, child);\r\nalgorithm/sorting.d:                    r.swapAt(parent, child);\r\nalgorithm/sorting.d:            r.swapAt(parent, child);\r\nalgorithm/sorting.d:            r.swapAt(parent, child);\r\ncontainer/binaryheap.d:            swapAt(_store, parentIdx, n);\r\nrandom.d:        swapAt(r, i, uniform(i, r.length, gen));\r\n```"},"comment":{"url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/comments/206819805","html_url":"https://github.com/D-Programming-Language/phobos/pull/4127#issuecomment-206819805","issue_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/4127","id":206819805,"user":{"login":"9il","id":845083,"avatar_url":"https://avatars.githubusercontent.com/u/845083?v=3","gravatar_id":"","url":"https://api.github.com/users/9il","html_url":"https://github.com/9il","followers_url":"https://api.github.com/users/9il/followers","following_url":"https://api.github.com/users/9il/following{/other_user}","gists_url":"https://api.github.com/users/9il/gists{/gist_id}","starred_url":"https://api.github.com/users/9il/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/9il/subscriptions","organizations_url":"https://api.github.com/users/9il/orgs","repos_url":"https://api.github.com/users/9il/repos","events_url":"https://api.github.com/users/9il/events{/privacy}","received_events_url":"https://api.github.com/users/9il/received_events","type":"User","site_admin":false},"created_at":"2016-04-07T11:08:45Z","updated_at":"2016-04-07T11:08:45Z","body":"`auto ref please`"}}