{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/12863","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/12863/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/12863/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/12863/events","html_url":"https://github.com/JuliaLang/julia/issues/12863","id":103823705,"number":12863,"title":"Modify permutations function to take a size argument","user":{"login":"kmsquire","id":223250,"avatar_url":"https://avatars.githubusercontent.com/u/223250?v=3","gravatar_id":"","url":"https://api.github.com/users/kmsquire","html_url":"https://github.com/kmsquire","followers_url":"https://api.github.com/users/kmsquire/followers","following_url":"https://api.github.com/users/kmsquire/following{/other_user}","gists_url":"https://api.github.com/users/kmsquire/gists{/gist_id}","starred_url":"https://api.github.com/users/kmsquire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmsquire/subscriptions","organizations_url":"https://api.github.com/users/kmsquire/orgs","repos_url":"https://api.github.com/users/kmsquire/repos","events_url":"https://api.github.com/users/kmsquire/events{/privacy}","received_events_url":"https://api.github.com/users/kmsquire/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/JuliaLang/julia/labels/intro%20issue","name":"intro issue","color":"0052cc"},{"url":"https://api.github.com/repos/JuliaLang/julia/labels/up%20for%20grabs","name":"up for grabs","color":"0b02e1"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-08-29T02:43:13Z","updated_at":"2015-08-29T18:19:16Z","closed_at":null,"body":"As seen [here](http://stackoverflow.com/questions/32280481/permutations-with-a-limited-length-in-julia):\r\n\r\n> In Python, you can use itertools to generate permutations like so:\r\n\r\n>     >>> list(itertools.permutations(\"ABC\", 2))\r\n     [('A', 'B'), ('A', 'C'), ('B', 'A'), ('B', 'C'), ('C', 'A'), ('C', 'B')]\r\n     Julia has a similar permutations function, but it only accepts one argument.\r\n\r\nIt woulds be a reasonable extension of the `permutations` function to add this."},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/136021489","html_url":"https://github.com/JuliaLang/julia/issues/12863#issuecomment-136021489","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/12863","id":136021489,"user":{"login":"kmsquire","id":223250,"avatar_url":"https://avatars.githubusercontent.com/u/223250?v=3","gravatar_id":"","url":"https://api.github.com/users/kmsquire","html_url":"https://github.com/kmsquire","followers_url":"https://api.github.com/users/kmsquire/followers","following_url":"https://api.github.com/users/kmsquire/following{/other_user}","gists_url":"https://api.github.com/users/kmsquire/gists{/gist_id}","starred_url":"https://api.github.com/users/kmsquire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmsquire/subscriptions","organizations_url":"https://api.github.com/users/kmsquire/orgs","repos_url":"https://api.github.com/users/kmsquire/repos","events_url":"https://api.github.com/users/kmsquire/events{/privacy}","received_events_url":"https://api.github.com/users/kmsquire/received_events","type":"User","site_admin":false},"created_at":"2015-08-29T18:19:16Z","updated_at":"2015-08-29T18:19:16Z","body":"> (or you can do what I proposed on SO)\r\n\r\nSure.\r\n\r\n```julia\r\njulia> collect(chain([permutations(x) for x in subsets(collect(\"ABC\"), 2)]...))\r\n6-element Array{Array{Char,1},1}:\r\n ['A','B']\r\n ['B','A']\r\n ['A','C']\r\n ['C','A']\r\n ['B','C']\r\n ['C','B']\r\n```\r\n\r\nI think that would take a little while for most users to figure out if they aren't familiar with the Iterators.jl package.  And I find it rather ugly.  \r\n\r\n(But I really would have no problem if the functionality suggested here were added there instead.)"}}