{"action":"created","comment":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/comments/32897932","id":32897932,"diff_hunk":"@@ -296,46 +296,95 @@ function extrema(itr)\n     return (vmin, vmax)\n end\n \n-## all & any\n+## any\n \n-function mapfoldl(f, ::AndFun, itr)\n+any(itr)    = any(IdFun(), itr)\n+any(f, itr) = any(specialized_unary(f), itr)\n+\n+function any(f::IdFun, itr)\n     for x in itr\n-        !f(x) && return false\n+        x && return true\n     end\n-    return true\n+    return false\n end\n \n-function mapfoldl(f, ::OrFun, itr)\n+function any(f::Func{1}, itr)\n     for x in itr\n         f(x) && return true\n     end\n     return false\n end\n \n-function mapreduce_impl(f, op::AndFun, A::AbstractArray{Bool}, ifirst::Int, ilast::Int)\n-    while ifirst <= ilast\n-        @inbounds x = A[ifirst]\n-        !f(x) && return false\n-        ifirst += 1\n+function any(f::IdFun, itr::Array{Bool, 1})\n+    i   = 1\n+    len = length(itr)\n+    while i <= len\n+       @inbounds x = itr[i]","path":"base/reduce.jl","position":37,"original_position":37,"commit_id":"4362a194251dd259adeda8a20010a4833152178c","original_commit_id":"4362a194251dd259adeda8a20010a4833152178c","user":{"login":"fcard","id":12222927,"avatar_url":"https://avatars.githubusercontent.com/u/12222927?v=3","gravatar_id":"","url":"https://api.github.com/users/fcard","html_url":"https://github.com/fcard","followers_url":"https://api.github.com/users/fcard/followers","following_url":"https://api.github.com/users/fcard/following{/other_user}","gists_url":"https://api.github.com/users/fcard/gists{/gist_id}","starred_url":"https://api.github.com/users/fcard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fcard/subscriptions","organizations_url":"https://api.github.com/users/fcard/orgs","repos_url":"https://api.github.com/users/fcard/repos","events_url":"https://api.github.com/users/fcard/events{/privacy}","received_events_url":"https://api.github.com/users/fcard/received_events","type":"User","site_admin":false},"body":"Apparently. `reduce.jl` is full of tricks like these, and the tests I did seem to confirm this: https://gist.github.com/fcard/aca7b07d24ff24b01d4d#file-sc-any-all-perf-summary-jl-L50-L55\r\n\r\nOnly for vectors, through, didn't do much for ranges or tuples.","created_at":"2015-06-21T21:32:00Z","updated_at":"2015-06-21T21:32:00Z","html_url":"https://github.com/JuliaLang/julia/pull/11774#discussion_r32897932","pull_request_url":"https://api.github.com/repos/JuliaLang/julia/pulls/11774","_links":{"self":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/comments/32897932"},"html":{"href":"https://github.com/JuliaLang/julia/pull/11774#discussion_r32897932"},"pull_request":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/11774"}}},"pull_request":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/11774","id":38160382,"html_url":"https://github.com/JuliaLang/julia/pull/11774","diff_url":"https://github.com/JuliaLang/julia/pull/11774.diff","patch_url":"https://github.com/JuliaLang/julia/pull/11774.patch","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/11774","number":11774,"state":"open","locked":false,"title":"Make `any` and `all` short-circuiting","user":{"login":"fcard","id":12222927,"avatar_url":"https://avatars.githubusercontent.com/u/12222927?v=3","gravatar_id":"","url":"https://api.github.com/users/fcard","html_url":"https://github.com/fcard","followers_url":"https://api.github.com/users/fcard/followers","following_url":"https://api.github.com/users/fcard/following{/other_user}","gists_url":"https://api.github.com/users/fcard/gists{/gist_id}","starred_url":"https://api.github.com/users/fcard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fcard/subscriptions","organizations_url":"https://api.github.com/users/fcard/orgs","repos_url":"https://api.github.com/users/fcard/repos","events_url":"https://api.github.com/users/fcard/events{/privacy}","received_events_url":"https://api.github.com/users/fcard/received_events","type":"User","site_admin":false},"body":"Doesn't apply for `n < 16`, but that shouldn't be a big problem, right? There is apparently optimizations for small `n`, so I decided not to mess with that.","created_at":"2015-06-20T01:28:10Z","updated_at":"2015-06-21T21:32:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eecd39e23dad25c5bfd7b39e0a5f53dbd56c434e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/JuliaLang/julia/pulls/11774/commits","review_comments_url":"https://api.github.com/repos/JuliaLang/julia/pulls/11774/comments","review_comment_url":"https://api.github.com/repos/JuliaLang/julia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/11774/comments","statuses_url":"https://api.github.com/repos/JuliaLang/julia/statuses/4362a194251dd259adeda8a20010a4833152178c","head":{"label":"fcard:patch-3","ref":"patch-3","sha":"4362a194251dd259adeda8a20010a4833152178c","user":{"login":"fcard","id":12222927,"avatar_url":"https://avatars.githubusercontent.com/u/12222927?v=3","gravatar_id":"","url":"https://api.github.com/users/fcard","html_url":"https://github.com/fcard","followers_url":"https://api.github.com/users/fcard/followers","following_url":"https://api.github.com/users/fcard/following{/other_user}","gists_url":"https://api.github.com/users/fcard/gists{/gist_id}","starred_url":"https://api.github.com/users/fcard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fcard/subscriptions","organizations_url":"https://api.github.com/users/fcard/orgs","repos_url":"https://api.github.com/users/fcard/repos","events_url":"https://api.github.com/users/fcard/events{/privacy}","received_events_url":"https://api.github.com/users/fcard/received_events","type":"User","site_admin":false},"repo":{"id":35950662,"name":"julia","full_name":"fcard/julia","owner":{"login":"fcard","id":12222927,"avatar_url":"https://avatars.githubusercontent.com/u/12222927?v=3","gravatar_id":"","url":"https://api.github.com/users/fcard","html_url":"https://github.com/fcard","followers_url":"https://api.github.com/users/fcard/followers","following_url":"https://api.github.com/users/fcard/following{/other_user}","gists_url":"https://api.github.com/users/fcard/gists{/gist_id}","starred_url":"https://api.github.com/users/fcard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fcard/subscriptions","organizations_url":"https://api.github.com/users/fcard/orgs","repos_url":"https://api.github.com/users/fcard/repos","events_url":"https://api.github.com/users/fcard/events{/privacy}","received_events_url":"https://api.github.com/users/fcard/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fcard/julia","description":"The Julia Language: A fresh approach to technical computing.","fork":true,"url":"https://api.github.com/repos/fcard/julia","forks_url":"https://api.github.com/repos/fcard/julia/forks","keys_url":"https://api.github.com/repos/fcard/julia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fcard/julia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fcard/julia/teams","hooks_url":"https://api.github.com/repos/fcard/julia/hooks","issue_events_url":"https://api.github.com/repos/fcard/julia/issues/events{/number}","events_url":"https://api.github.com/repos/fcard/julia/events","assignees_url":"https://api.github.com/repos/fcard/julia/assignees{/user}","branches_url":"https://api.github.com/repos/fcard/julia/branches{/branch}","tags_url":"https://api.github.com/repos/fcard/julia/tags","blobs_url":"https://api.github.com/repos/fcard/julia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fcard/julia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fcard/julia/git/refs{/sha}","trees_url":"https://api.github.com/repos/fcard/julia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fcard/julia/statuses/{sha}","languages_url":"https://api.github.com/repos/fcard/julia/languages","stargazers_url":"https://api.github.com/repos/fcard/julia/stargazers","contributors_url":"https://api.github.com/repos/fcard/julia/contributors","subscribers_url":"https://api.github.com/repos/fcard/julia/subscribers","subscription_url":"https://api.github.com/repos/fcard/julia/subscription","commits_url":"https://api.github.com/repos/fcard/julia/commits{/sha}","git_commits_url":"https://api.github.com/repos/fcard/julia/git/commits{/sha}","comments_url":"https://api.github.com/repos/fcard/julia/comments{/number}","issue_comment_url":"https://api.github.com/repos/fcard/julia/issues/comments{/number}","contents_url":"https://api.github.com/repos/fcard/julia/contents/{+path}","compare_url":"https://api.github.com/repos/fcard/julia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fcard/julia/merges","archive_url":"https://api.github.com/repos/fcard/julia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fcard/julia/downloads","issues_url":"https://api.github.com/repos/fcard/julia/issues{/number}","pulls_url":"https://api.github.com/repos/fcard/julia/pulls{/number}","milestones_url":"https://api.github.com/repos/fcard/julia/milestones{/number}","notifications_url":"https://api.github.com/repos/fcard/julia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fcard/julia/labels{/name}","releases_url":"https://api.github.com/repos/fcard/julia/releases{/id}","created_at":"2015-05-20T13:47:33Z","updated_at":"2015-05-20T13:47:38Z","pushed_at":"2015-06-21T20:40:38Z","git_url":"git://github.com/fcard/julia.git","ssh_url":"git@github.com:fcard/julia.git","clone_url":"https://github.com/fcard/julia.git","svn_url":"https://github.com/fcard/julia","homepage":"http://julialang.org/","size":75423,"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":"2327eddbd870501d93f6e6e344171e126df29c8f","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-06-21T21:17:10Z","pushed_at":"2015-06-21T21:25:52Z","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":195310,"stargazers_count":5696,"watchers_count":5696,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1197,"mirror_url":null,"open_issues_count":1314,"forks":1197,"open_issues":1314,"watchers":5696,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/11774"},"html":{"href":"https://github.com/JuliaLang/julia/pull/11774"},"issue":{"href":"https://api.github.com/repos/JuliaLang/julia/issues/11774"},"comments":{"href":"https://api.github.com/repos/JuliaLang/julia/issues/11774/comments"},"review_comments":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/11774/comments"},"review_comment":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/11774/commits"},"statuses":{"href":"https://api.github.com/repos/JuliaLang/julia/statuses/4362a194251dd259adeda8a20010a4833152178c"}}}}