{"action":"created","comment":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/comments/94086855","pull_request_review_id":14617515,"id":94086855,"diff_hunk":"@@ -1165,8 +1165,46 @@ function logdet(A::AbstractMatrix)\n     return d + log(s)\n end\n \n+\"\"\"\n+    promote_leaf_eltypes(itr)\n+\n+For an (possibly nested) iterable object `itr`, promote the types of leaf\n+elements.  Equivalent to `promote_type(typeof(leaf1), typeof(leaf2), ...)`.\n+\n+# Example\n+\n+```jldoctest\n+julia> a = [[1,2, [3,4]], 5.0, [6im, [7.0, 8.0]]]\n+3-element Array{Any,1}:\n+  Any[1,2,[3,4]]\n+ 5.0\n+  Any[0+6im,[7.0,8.0]]\n+\n+julia> promote_leaf_eltypes(a)\n+Complex{Float64}\n+```\n+\"\"\"\n+function promote_leaf_eltypes(itr)\n+    if !isa(itr, AbstractArray) && !isa(itr, Tuple)  # handles arrays, tuples, ranges\n+        return typeof(itr)\n+    else\n+        s = start(itr)\n+        (i, s) = next(itr, s)\n+        t = promote_leaf_eltypes(i)\n+        while !done(itr, s)","path":"base/linalg/generic.jl","position":30,"original_position":30,"commit_id":"1be909ffb3d451b07569ae46d722c9c815d03939","original_commit_id":"1be909ffb3d451b07569ae46d722c9c815d03939","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":"In general, we'd prefer to reduce the number of `promote_foo` functions in Julia rather than increase them, so I'm skeptical that we would want to encourage the use of `promote_leaf_eltypes` elsewhere, especially if a general implementation requires iterating over the whole array.","created_at":"2016-12-28T23:03:44Z","updated_at":"2016-12-28T23:03:44Z","html_url":"https://github.com/JuliaLang/julia/pull/19637#discussion_r94086855","pull_request_url":"https://api.github.com/repos/JuliaLang/julia/pulls/19637","_links":{"self":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/comments/94086855"},"html":{"href":"https://github.com/JuliaLang/julia/pull/19637#discussion_r94086855"},"pull_request":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/19637"}}},"pull_request":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/19637","id":98457453,"html_url":"https://github.com/JuliaLang/julia/pull/19637","diff_url":"https://github.com/JuliaLang/julia/pull/19637.diff","patch_url":"https://github.com/JuliaLang/julia/pull/19637.patch","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/19637","number":19637,"state":"open","locked":false,"title":"Generalize isapprox() to support nested arrays","user":{"login":"wsshin","id":1783289,"avatar_url":"https://avatars.githubusercontent.com/u/1783289?v=3","gravatar_id":"","url":"https://api.github.com/users/wsshin","html_url":"https://github.com/wsshin","followers_url":"https://api.github.com/users/wsshin/followers","following_url":"https://api.github.com/users/wsshin/following{/other_user}","gists_url":"https://api.github.com/users/wsshin/gists{/gist_id}","starred_url":"https://api.github.com/users/wsshin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wsshin/subscriptions","organizations_url":"https://api.github.com/users/wsshin/orgs","repos_url":"https://api.github.com/users/wsshin/repos","events_url":"https://api.github.com/users/wsshin/events{/privacy}","received_events_url":"https://api.github.com/users/wsshin/received_events","type":"User","site_admin":false},"body":"- Implement `promote_leaf_eltypes()` to find the type promoted from all\r\n  leaf types of a given nested array.\r\n- Change the argument types of `isapprox()` from\r\n  `AbstractArray{T<:Number}` to `AbstractArray` to accept nested arrays.\r\n- Change the default value of the argument `rtol` of `isapprox()` from\r\n  `rtoldefault(T,S)` to `rtoldefault(promote_leaf_eltypes(x),\r\n  promote_leaf_eltypes(y))`.\r\n- Add tests for the new functionalities.","created_at":"2016-12-17T22:10:02Z","updated_at":"2016-12-28T23:03:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e852c83b9142d7ba54fea059f0b8e875736dc454","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/JuliaLang/julia/pulls/19637/commits","review_comments_url":"https://api.github.com/repos/JuliaLang/julia/pulls/19637/comments","review_comment_url":"https://api.github.com/repos/JuliaLang/julia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/19637/comments","statuses_url":"https://api.github.com/repos/JuliaLang/julia/statuses/1be909ffb3d451b07569ae46d722c9c815d03939","head":{"label":"wsshin:isapprox-generalized","ref":"isapprox-generalized","sha":"1be909ffb3d451b07569ae46d722c9c815d03939","user":{"login":"wsshin","id":1783289,"avatar_url":"https://avatars.githubusercontent.com/u/1783289?v=3","gravatar_id":"","url":"https://api.github.com/users/wsshin","html_url":"https://github.com/wsshin","followers_url":"https://api.github.com/users/wsshin/followers","following_url":"https://api.github.com/users/wsshin/following{/other_user}","gists_url":"https://api.github.com/users/wsshin/gists{/gist_id}","starred_url":"https://api.github.com/users/wsshin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wsshin/subscriptions","organizations_url":"https://api.github.com/users/wsshin/orgs","repos_url":"https://api.github.com/users/wsshin/repos","events_url":"https://api.github.com/users/wsshin/events{/privacy}","received_events_url":"https://api.github.com/users/wsshin/received_events","type":"User","site_admin":false},"repo":{"id":76749118,"name":"julia","full_name":"wsshin/julia","owner":{"login":"wsshin","id":1783289,"avatar_url":"https://avatars.githubusercontent.com/u/1783289?v=3","gravatar_id":"","url":"https://api.github.com/users/wsshin","html_url":"https://github.com/wsshin","followers_url":"https://api.github.com/users/wsshin/followers","following_url":"https://api.github.com/users/wsshin/following{/other_user}","gists_url":"https://api.github.com/users/wsshin/gists{/gist_id}","starred_url":"https://api.github.com/users/wsshin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wsshin/subscriptions","organizations_url":"https://api.github.com/users/wsshin/orgs","repos_url":"https://api.github.com/users/wsshin/repos","events_url":"https://api.github.com/users/wsshin/events{/privacy}","received_events_url":"https://api.github.com/users/wsshin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wsshin/julia","description":"The Julia Language: A fresh approach to technical computing.","fork":true,"url":"https://api.github.com/repos/wsshin/julia","forks_url":"https://api.github.com/repos/wsshin/julia/forks","keys_url":"https://api.github.com/repos/wsshin/julia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wsshin/julia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wsshin/julia/teams","hooks_url":"https://api.github.com/repos/wsshin/julia/hooks","issue_events_url":"https://api.github.com/repos/wsshin/julia/issues/events{/number}","events_url":"https://api.github.com/repos/wsshin/julia/events","assignees_url":"https://api.github.com/repos/wsshin/julia/assignees{/user}","branches_url":"https://api.github.com/repos/wsshin/julia/branches{/branch}","tags_url":"https://api.github.com/repos/wsshin/julia/tags","blobs_url":"https://api.github.com/repos/wsshin/julia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wsshin/julia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wsshin/julia/git/refs{/sha}","trees_url":"https://api.github.com/repos/wsshin/julia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wsshin/julia/statuses/{sha}","languages_url":"https://api.github.com/repos/wsshin/julia/languages","stargazers_url":"https://api.github.com/repos/wsshin/julia/stargazers","contributors_url":"https://api.github.com/repos/wsshin/julia/contributors","subscribers_url":"https://api.github.com/repos/wsshin/julia/subscribers","subscription_url":"https://api.github.com/repos/wsshin/julia/subscription","commits_url":"https://api.github.com/repos/wsshin/julia/commits{/sha}","git_commits_url":"https://api.github.com/repos/wsshin/julia/git/commits{/sha}","comments_url":"https://api.github.com/repos/wsshin/julia/comments{/number}","issue_comment_url":"https://api.github.com/repos/wsshin/julia/issues/comments{/number}","contents_url":"https://api.github.com/repos/wsshin/julia/contents/{+path}","compare_url":"https://api.github.com/repos/wsshin/julia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wsshin/julia/merges","archive_url":"https://api.github.com/repos/wsshin/julia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wsshin/julia/downloads","issues_url":"https://api.github.com/repos/wsshin/julia/issues{/number}","pulls_url":"https://api.github.com/repos/wsshin/julia/pulls{/number}","milestones_url":"https://api.github.com/repos/wsshin/julia/milestones{/number}","notifications_url":"https://api.github.com/repos/wsshin/julia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wsshin/julia/labels{/name}","releases_url":"https://api.github.com/repos/wsshin/julia/releases{/id}","deployments_url":"https://api.github.com/repos/wsshin/julia/deployments","created_at":"2016-12-17T22:06:18Z","updated_at":"2016-12-17T22:06:28Z","pushed_at":"2016-12-18T22:33:11Z","git_url":"git://github.com/wsshin/julia.git","ssh_url":"git@github.com:wsshin/julia.git","clone_url":"https://github.com/wsshin/julia.git","svn_url":"https://github.com/wsshin/julia","homepage":"http://julialang.org/","size":115433,"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":"ded22594ec4f4ec83d40159b3a181ca5f90915ba","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}","deployments_url":"https://api.github.com/repos/JuliaLang/julia/deployments","created_at":"2011-04-21T07:01:50Z","updated_at":"2016-12-28T09:04:30Z","pushed_at":"2016-12-28T22:54:33Z","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":117567,"stargazers_count":7949,"watchers_count":7949,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1867,"mirror_url":null,"open_issues_count":2244,"forks":1867,"open_issues":2244,"watchers":7949,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/19637"},"html":{"href":"https://github.com/JuliaLang/julia/pull/19637"},"issue":{"href":"https://api.github.com/repos/JuliaLang/julia/issues/19637"},"comments":{"href":"https://api.github.com/repos/JuliaLang/julia/issues/19637/comments"},"review_comments":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/19637/comments"},"review_comment":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/19637/commits"},"statuses":{"href":"https://api.github.com/repos/JuliaLang/julia/statuses/1be909ffb3d451b07569ae46d722c9c815d03939"}}}}
{"actor":{"display_login":"stevengj"}}