{"action":"created","comment":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/comments/41950010","id":41950010,"diff_hunk":"@@ -244,6 +244,75 @@ function show(io::IO, r::LinSpace)\n     print(io, ')')\n end\n \n+# `print_range(io, r)` prints out a nice looking range r in terms of its elements","path":"base/range.jl","position":4,"original_position":4,"commit_id":"5e05afe9c24d0f4972ea68e5e88447bfe06df3d7","original_commit_id":"5e05afe9c24d0f4972ea68e5e88447bfe06df3d7","user":{"login":"stevengj","id":2913679,"avatar_url":"https://avatars.githubusercontent.com/u/2913679?v=3","gravatar_id":"","url":"https://api.github.com/users/stevengj","html_url":"https://github.com/stevengj","followers_url":"https://api.github.com/users/stevengj/followers","following_url":"https://api.github.com/users/stevengj/following{/other_user}","gists_url":"https://api.github.com/users/stevengj/gists{/gist_id}","starred_url":"https://api.github.com/users/stevengj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevengj/subscriptions","organizations_url":"https://api.github.com/users/stevengj/orgs","repos_url":"https://api.github.com/users/stevengj/repos","events_url":"https://api.github.com/users/stevengj/events{/privacy}","received_events_url":"https://api.github.com/users/stevengj/received_events","type":"User","site_admin":false},"body":"don't duplicate the docstring in a comment.  Just say `# See docstring below.`","created_at":"2015-10-14T02:41:11Z","updated_at":"2015-10-14T02:41:11Z","html_url":"https://github.com/JuliaLang/julia/pull/13534#discussion_r41950010","pull_request_url":"https://api.github.com/repos/JuliaLang/julia/pulls/13534","_links":{"self":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/comments/41950010"},"html":{"href":"https://github.com/JuliaLang/julia/pull/13534#discussion_r41950010"},"pull_request":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/13534"}}},"pull_request":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/13534","id":47349591,"html_url":"https://github.com/JuliaLang/julia/pull/13534","diff_url":"https://github.com/JuliaLang/julia/pull/13534.diff","patch_url":"https://github.com/JuliaLang/julia/pull/13534.patch","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/13534","number":13534,"state":"open","locked":false,"title":"New range display2","user":{"login":"artkuo","id":2893800,"avatar_url":"https://avatars.githubusercontent.com/u/2893800?v=3","gravatar_id":"","url":"https://api.github.com/users/artkuo","html_url":"https://github.com/artkuo","followers_url":"https://api.github.com/users/artkuo/followers","following_url":"https://api.github.com/users/artkuo/following{/other_user}","gists_url":"https://api.github.com/users/artkuo/gists{/gist_id}","starred_url":"https://api.github.com/users/artkuo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artkuo/subscriptions","organizations_url":"https://api.github.com/users/artkuo/orgs","repos_url":"https://api.github.com/users/artkuo/repos","events_url":"https://api.github.com/users/artkuo/events{/privacy}","received_events_url":"https://api.github.com/users/artkuo/received_events","type":"User","site_admin":false},"body":"This is the result of a [user's forum discussion about ranges](https://groups.google.com/forum/#!searchin/julia-users/nicer/julia-users/qPqgJS-usrU/Hu40_tOlDQAJ). People were unhappy that `0:5` or `linspace(1,10,7)` does not return a vector, as they wanted. I believe it is sensible for these to be `range` objects (rather than being converted via `collect`), but the REPL display could be modified to show what the `range` actually looks like. The user probably wants to see some confirmation of what they were thinking, and seeing the definition doesn't help.\r\n\r\nThe proposed solution is to give REPL output like this:\r\n```\r\njulia> 0:4\r\n5-element UnitRange{Int64}:\r\n 0,1,2,3,4\r\n\r\njulia> 0:100\r\n101-element UnitRange{Int64}:\r\n 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,…,89,90,91,92,93,94,95,96,97,98,99,100\r\n\r\njulia> linspace(0,2.5,4)\r\n4-element LinSpace{Float64}:\r\n 0.0,0.833333,1.66667,2.5\r\n```\r\n\r\nThis is accomplished by overloading writemime (replutil.jl) to respond to `range` objects, adding a `print_range` method (range.jl) and appropriate unit tests (test/ranges.jl). This affects `display()`, but the user can still use `show(1:5)` to return the definition `1:5`. The `print_range` method is based on the existing `print_matrix_row`, and so it uses knowledge of screen size to make everything fit in one row, with horizontal dots (ellipsis) where appropriate.\r\n\r\nAdditional edits were made to show.jl, where I added a bunch of comments. I had to learn how `print_matrix` works, and the comments are meant to save time for someone like me, as the code is a bit opaque. There were absolutely no changes to execution of show.jl.\r\n\r\nA few notes. I decided not to add brackets around the range. Perhaps square brackets would be appropriate, but I felt they were not needed, as a range is not exactly an array. Also, the range is printed as a single row to save vertical screen space. I thought this was acceptable because tuples are also printed across, despite acting somewhat like 1-d arrays, which are kind of \"vertical.\" I would appreciate feedback if there are disagreements about these choices, or about the whole idea of modifying the REPL.\r\n\r\nThis is take 2: Fixed test to allow for 32- or 64-bit systems; changed pull request to base from master","created_at":"2015-10-10T17:08:48Z","updated_at":"2015-10-14T02:41:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"809eb33382d5ddda733d866190558200a549b704","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/JuliaLang/julia/pulls/13534/commits","review_comments_url":"https://api.github.com/repos/JuliaLang/julia/pulls/13534/comments","review_comment_url":"https://api.github.com/repos/JuliaLang/julia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/13534/comments","statuses_url":"https://api.github.com/repos/JuliaLang/julia/statuses/5e05afe9c24d0f4972ea68e5e88447bfe06df3d7","head":{"label":"artkuo:new_range_display2","ref":"new_range_display2","sha":"5e05afe9c24d0f4972ea68e5e88447bfe06df3d7","user":{"login":"artkuo","id":2893800,"avatar_url":"https://avatars.githubusercontent.com/u/2893800?v=3","gravatar_id":"","url":"https://api.github.com/users/artkuo","html_url":"https://github.com/artkuo","followers_url":"https://api.github.com/users/artkuo/followers","following_url":"https://api.github.com/users/artkuo/following{/other_user}","gists_url":"https://api.github.com/users/artkuo/gists{/gist_id}","starred_url":"https://api.github.com/users/artkuo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artkuo/subscriptions","organizations_url":"https://api.github.com/users/artkuo/orgs","repos_url":"https://api.github.com/users/artkuo/repos","events_url":"https://api.github.com/users/artkuo/events{/privacy}","received_events_url":"https://api.github.com/users/artkuo/received_events","type":"User","site_admin":false},"repo":{"id":24970883,"name":"julia","full_name":"artkuo/julia","owner":{"login":"artkuo","id":2893800,"avatar_url":"https://avatars.githubusercontent.com/u/2893800?v=3","gravatar_id":"","url":"https://api.github.com/users/artkuo","html_url":"https://github.com/artkuo","followers_url":"https://api.github.com/users/artkuo/followers","following_url":"https://api.github.com/users/artkuo/following{/other_user}","gists_url":"https://api.github.com/users/artkuo/gists{/gist_id}","starred_url":"https://api.github.com/users/artkuo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artkuo/subscriptions","organizations_url":"https://api.github.com/users/artkuo/orgs","repos_url":"https://api.github.com/users/artkuo/repos","events_url":"https://api.github.com/users/artkuo/events{/privacy}","received_events_url":"https://api.github.com/users/artkuo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/artkuo/julia","description":"The Julia Language: A fresh approach to technical computing.","fork":true,"url":"https://api.github.com/repos/artkuo/julia","forks_url":"https://api.github.com/repos/artkuo/julia/forks","keys_url":"https://api.github.com/repos/artkuo/julia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/artkuo/julia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/artkuo/julia/teams","hooks_url":"https://api.github.com/repos/artkuo/julia/hooks","issue_events_url":"https://api.github.com/repos/artkuo/julia/issues/events{/number}","events_url":"https://api.github.com/repos/artkuo/julia/events","assignees_url":"https://api.github.com/repos/artkuo/julia/assignees{/user}","branches_url":"https://api.github.com/repos/artkuo/julia/branches{/branch}","tags_url":"https://api.github.com/repos/artkuo/julia/tags","blobs_url":"https://api.github.com/repos/artkuo/julia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/artkuo/julia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/artkuo/julia/git/refs{/sha}","trees_url":"https://api.github.com/repos/artkuo/julia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/artkuo/julia/statuses/{sha}","languages_url":"https://api.github.com/repos/artkuo/julia/languages","stargazers_url":"https://api.github.com/repos/artkuo/julia/stargazers","contributors_url":"https://api.github.com/repos/artkuo/julia/contributors","subscribers_url":"https://api.github.com/repos/artkuo/julia/subscribers","subscription_url":"https://api.github.com/repos/artkuo/julia/subscription","commits_url":"https://api.github.com/repos/artkuo/julia/commits{/sha}","git_commits_url":"https://api.github.com/repos/artkuo/julia/git/commits{/sha}","comments_url":"https://api.github.com/repos/artkuo/julia/comments{/number}","issue_comment_url":"https://api.github.com/repos/artkuo/julia/issues/comments{/number}","contents_url":"https://api.github.com/repos/artkuo/julia/contents/{+path}","compare_url":"https://api.github.com/repos/artkuo/julia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/artkuo/julia/merges","archive_url":"https://api.github.com/repos/artkuo/julia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/artkuo/julia/downloads","issues_url":"https://api.github.com/repos/artkuo/julia/issues{/number}","pulls_url":"https://api.github.com/repos/artkuo/julia/pulls{/number}","milestones_url":"https://api.github.com/repos/artkuo/julia/milestones{/number}","notifications_url":"https://api.github.com/repos/artkuo/julia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/artkuo/julia/labels{/name}","releases_url":"https://api.github.com/repos/artkuo/julia/releases{/id}","created_at":"2014-10-09T02:48:59Z","updated_at":"2014-10-13T03:13:08Z","pushed_at":"2015-10-14T02:29:34Z","git_url":"git://github.com/artkuo/julia.git","ssh_url":"git@github.com:artkuo/julia.git","clone_url":"https://github.com/artkuo/julia.git","svn_url":"https://github.com/artkuo/julia","homepage":"http://julialang.org/","size":85531,"stargazers_count":0,"watchers_count":0,"language":"Julia","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"JuliaLang:master","ref":"master","sha":"ae154d076a6ae75bfdb9a0a377a6a5f9b0e1096f","user":{"login":"JuliaLang","id":743164,"avatar_url":"https://avatars.githubusercontent.com/u/743164?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaLang","html_url":"https://github.com/JuliaLang","followers_url":"https://api.github.com/users/JuliaLang/followers","following_url":"https://api.github.com/users/JuliaLang/following{/other_user}","gists_url":"https://api.github.com/users/JuliaLang/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaLang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaLang/subscriptions","organizations_url":"https://api.github.com/users/JuliaLang/orgs","repos_url":"https://api.github.com/users/JuliaLang/repos","events_url":"https://api.github.com/users/JuliaLang/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaLang/received_events","type":"Organization","site_admin":false},"repo":{"id":1644196,"name":"julia","full_name":"JuliaLang/julia","owner":{"login":"JuliaLang","id":743164,"avatar_url":"https://avatars.githubusercontent.com/u/743164?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaLang","html_url":"https://github.com/JuliaLang","followers_url":"https://api.github.com/users/JuliaLang/followers","following_url":"https://api.github.com/users/JuliaLang/following{/other_user}","gists_url":"https://api.github.com/users/JuliaLang/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaLang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaLang/subscriptions","organizations_url":"https://api.github.com/users/JuliaLang/orgs","repos_url":"https://api.github.com/users/JuliaLang/repos","events_url":"https://api.github.com/users/JuliaLang/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaLang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JuliaLang/julia","description":"The Julia Language: A fresh approach to technical computing.","fork":false,"url":"https://api.github.com/repos/JuliaLang/julia","forks_url":"https://api.github.com/repos/JuliaLang/julia/forks","keys_url":"https://api.github.com/repos/JuliaLang/julia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaLang/julia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaLang/julia/teams","hooks_url":"https://api.github.com/repos/JuliaLang/julia/hooks","issue_events_url":"https://api.github.com/repos/JuliaLang/julia/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaLang/julia/events","assignees_url":"https://api.github.com/repos/JuliaLang/julia/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaLang/julia/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaLang/julia/tags","blobs_url":"https://api.github.com/repos/JuliaLang/julia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaLang/julia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaLang/julia/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaLang/julia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaLang/julia/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaLang/julia/languages","stargazers_url":"https://api.github.com/repos/JuliaLang/julia/stargazers","contributors_url":"https://api.github.com/repos/JuliaLang/julia/contributors","subscribers_url":"https://api.github.com/repos/JuliaLang/julia/subscribers","subscription_url":"https://api.github.com/repos/JuliaLang/julia/subscription","commits_url":"https://api.github.com/repos/JuliaLang/julia/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaLang/julia/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaLang/julia/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaLang/julia/issues/comments{/number}","contents_url":"https://api.github.com/repos/JuliaLang/julia/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaLang/julia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaLang/julia/merges","archive_url":"https://api.github.com/repos/JuliaLang/julia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaLang/julia/downloads","issues_url":"https://api.github.com/repos/JuliaLang/julia/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaLang/julia/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaLang/julia/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaLang/julia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaLang/julia/labels{/name}","releases_url":"https://api.github.com/repos/JuliaLang/julia/releases{/id}","created_at":"2011-04-21T07:01:50Z","updated_at":"2015-10-14T00:36:37Z","pushed_at":"2015-10-14T02:29:35Z","git_url":"git://github.com/JuliaLang/julia.git","ssh_url":"git@github.com:JuliaLang/julia.git","clone_url":"https://github.com/JuliaLang/julia.git","svn_url":"https://github.com/JuliaLang/julia","homepage":"http://julialang.org/","size":234249,"stargazers_count":6142,"watchers_count":6142,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1343,"mirror_url":null,"open_issues_count":1478,"forks":1343,"open_issues":1478,"watchers":6142,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/13534"},"html":{"href":"https://github.com/JuliaLang/julia/pull/13534"},"issue":{"href":"https://api.github.com/repos/JuliaLang/julia/issues/13534"},"comments":{"href":"https://api.github.com/repos/JuliaLang/julia/issues/13534/comments"},"review_comments":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/13534/comments"},"review_comment":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/13534/commits"},"statuses":{"href":"https://api.github.com/repos/JuliaLang/julia/statuses/5e05afe9c24d0f4972ea68e5e88447bfe06df3d7"}}}}