{"action":"created","comment":{"url":"https://api.github.com/repos/nim-lang/Nim/pulls/comments/32401555","id":32401555,"diff_hunk":"@@ -401,25 +401,30 @@ template foldr*(sequence, operation: expr): expr =\n     result = operation\n   result\n \n-template mapIt*(seq1, typ, op: expr): expr =\n+template mapIt*[T,S](seq1: openArray[T], op: expr): seq[S] =\n   ## Convenience template around the ``map`` proc to reduce typing.\n   ##\n   ## The template injects the ``it`` variable which you can use directly in an\n-  ## expression. You also need to pass as `typ` the type of the expression,\n-  ## since the new returned sequence can have a different type than the\n-  ## original.  Example:\n+  ## expression. Example:\n   ##\n   ## .. code-block::\n   ##   let\n   ##     nums = @[1, 2, 3, 4]\n-  ##     strings = nums.mapIt(string, $(4 * it))\n+  ##     strings = nums.mapIt($(4 * it))\n   ##   assert strings == @[\"4\", \"8\", \"12\", \"16\"]\n-  var result {.gensym.}: seq[typ] = @[]\n+  type T {.gensym.} = type(seq1[0])","path":"lib/pure/collections/sequtils.nim","position":66,"original_position":66,"commit_id":"d159bdf7b06c19f0b06014396185755427d936cd","original_commit_id":"d159bdf7b06c19f0b06014396185755427d936cd","user":{"login":"Araq","id":287816,"avatar_url":"https://avatars.githubusercontent.com/u/287816?v=3","gravatar_id":"","url":"https://api.github.com/users/Araq","html_url":"https://github.com/Araq","followers_url":"https://api.github.com/users/Araq/followers","following_url":"https://api.github.com/users/Araq/following{/other_user}","gists_url":"https://api.github.com/users/Araq/gists{/gist_id}","starred_url":"https://api.github.com/users/Araq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Araq/subscriptions","organizations_url":"https://api.github.com/users/Araq/orgs","repos_url":"https://api.github.com/users/Araq/repos","events_url":"https://api.github.com/users/Araq/events{/privacy}","received_events_url":"https://api.github.com/users/Araq/received_events","type":"User","site_admin":false},"body":"These .gensyms are actually not necessary since it's the default.","created_at":"2015-06-15T08:58:04Z","updated_at":"2015-06-15T08:58:04Z","html_url":"https://github.com/nim-lang/Nim/pull/2918#discussion_r32401555","pull_request_url":"https://api.github.com/repos/nim-lang/Nim/pulls/2918","_links":{"self":{"href":"https://api.github.com/repos/nim-lang/Nim/pulls/comments/32401555"},"html":{"href":"https://github.com/nim-lang/Nim/pull/2918#discussion_r32401555"},"pull_request":{"href":"https://api.github.com/repos/nim-lang/Nim/pulls/2918"}}},"pull_request":{"url":"https://api.github.com/repos/nim-lang/Nim/pulls/2918","id":37632284,"html_url":"https://github.com/nim-lang/Nim/pull/2918","diff_url":"https://github.com/nim-lang/Nim/pull/2918.diff","patch_url":"https://github.com/nim-lang/Nim/pull/2918.patch","issue_url":"https://api.github.com/repos/nim-lang/Nim/issues/2918","number":2918,"state":"open","locked":false,"title":"Changes in seqUtils.nim","user":{"login":"petermora","id":1550359,"avatar_url":"https://avatars.githubusercontent.com/u/1550359?v=3","gravatar_id":"","url":"https://api.github.com/users/petermora","html_url":"https://github.com/petermora","followers_url":"https://api.github.com/users/petermora/followers","following_url":"https://api.github.com/users/petermora/following{/other_user}","gists_url":"https://api.github.com/users/petermora/gists{/gist_id}","starred_url":"https://api.github.com/users/petermora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petermora/subscriptions","organizations_url":"https://api.github.com/users/petermora/orgs","repos_url":"https://api.github.com/users/petermora/repos","events_url":"https://api.github.com/users/petermora/events{/privacy}","received_events_url":"https://api.github.com/users/petermora/received_events","type":"User","site_admin":false},"body":"I've removed type parameter from mapIt, because we can learn it from the given operator. The mapIt function now allocates the array in advance. I've renamed the second mapIt template to replaceIt. And added types to template headers to limit the cases when they can be called.\r\n\r\nThis is my frst commit to Nim, and I can break other people code with this change. However, I don't think that mapIt should take the type of the returned sequence, because that information is available.","created_at":"2015-06-13T22:14:47Z","updated_at":"2015-06-15T08:58:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2c71794d769dddec53fd31561f9a9c0a06ccbb35","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nim-lang/Nim/pulls/2918/commits","review_comments_url":"https://api.github.com/repos/nim-lang/Nim/pulls/2918/comments","review_comment_url":"https://api.github.com/repos/nim-lang/Nim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nim-lang/Nim/issues/2918/comments","statuses_url":"https://api.github.com/repos/nim-lang/Nim/statuses/d159bdf7b06c19f0b06014396185755427d936cd","head":{"label":"petermora:devel","ref":"devel","sha":"d159bdf7b06c19f0b06014396185755427d936cd","user":{"login":"petermora","id":1550359,"avatar_url":"https://avatars.githubusercontent.com/u/1550359?v=3","gravatar_id":"","url":"https://api.github.com/users/petermora","html_url":"https://github.com/petermora","followers_url":"https://api.github.com/users/petermora/followers","following_url":"https://api.github.com/users/petermora/following{/other_user}","gists_url":"https://api.github.com/users/petermora/gists{/gist_id}","starred_url":"https://api.github.com/users/petermora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petermora/subscriptions","organizations_url":"https://api.github.com/users/petermora/orgs","repos_url":"https://api.github.com/users/petermora/repos","events_url":"https://api.github.com/users/petermora/events{/privacy}","received_events_url":"https://api.github.com/users/petermora/received_events","type":"User","site_admin":false},"repo":{"id":37387839,"name":"Nim","full_name":"petermora/Nim","owner":{"login":"petermora","id":1550359,"avatar_url":"https://avatars.githubusercontent.com/u/1550359?v=3","gravatar_id":"","url":"https://api.github.com/users/petermora","html_url":"https://github.com/petermora","followers_url":"https://api.github.com/users/petermora/followers","following_url":"https://api.github.com/users/petermora/following{/other_user}","gists_url":"https://api.github.com/users/petermora/gists{/gist_id}","starred_url":"https://api.github.com/users/petermora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petermora/subscriptions","organizations_url":"https://api.github.com/users/petermora/orgs","repos_url":"https://api.github.com/users/petermora/repos","events_url":"https://api.github.com/users/petermora/events{/privacy}","received_events_url":"https://api.github.com/users/petermora/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/petermora/Nim","description":"Nim (formerly known as \"Nimrod\") is a compiled, garbage-collected systems programming language which has an excellent productivity/performance ratio. Nim's design focuses on efficiency, expressiveness, elegance (in the order of priority).","fork":true,"url":"https://api.github.com/repos/petermora/Nim","forks_url":"https://api.github.com/repos/petermora/Nim/forks","keys_url":"https://api.github.com/repos/petermora/Nim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/petermora/Nim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/petermora/Nim/teams","hooks_url":"https://api.github.com/repos/petermora/Nim/hooks","issue_events_url":"https://api.github.com/repos/petermora/Nim/issues/events{/number}","events_url":"https://api.github.com/repos/petermora/Nim/events","assignees_url":"https://api.github.com/repos/petermora/Nim/assignees{/user}","branches_url":"https://api.github.com/repos/petermora/Nim/branches{/branch}","tags_url":"https://api.github.com/repos/petermora/Nim/tags","blobs_url":"https://api.github.com/repos/petermora/Nim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/petermora/Nim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/petermora/Nim/git/refs{/sha}","trees_url":"https://api.github.com/repos/petermora/Nim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/petermora/Nim/statuses/{sha}","languages_url":"https://api.github.com/repos/petermora/Nim/languages","stargazers_url":"https://api.github.com/repos/petermora/Nim/stargazers","contributors_url":"https://api.github.com/repos/petermora/Nim/contributors","subscribers_url":"https://api.github.com/repos/petermora/Nim/subscribers","subscription_url":"https://api.github.com/repos/petermora/Nim/subscription","commits_url":"https://api.github.com/repos/petermora/Nim/commits{/sha}","git_commits_url":"https://api.github.com/repos/petermora/Nim/git/commits{/sha}","comments_url":"https://api.github.com/repos/petermora/Nim/comments{/number}","issue_comment_url":"https://api.github.com/repos/petermora/Nim/issues/comments{/number}","contents_url":"https://api.github.com/repos/petermora/Nim/contents/{+path}","compare_url":"https://api.github.com/repos/petermora/Nim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/petermora/Nim/merges","archive_url":"https://api.github.com/repos/petermora/Nim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/petermora/Nim/downloads","issues_url":"https://api.github.com/repos/petermora/Nim/issues{/number}","pulls_url":"https://api.github.com/repos/petermora/Nim/pulls{/number}","milestones_url":"https://api.github.com/repos/petermora/Nim/milestones{/number}","notifications_url":"https://api.github.com/repos/petermora/Nim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/petermora/Nim/labels{/name}","releases_url":"https://api.github.com/repos/petermora/Nim/releases{/id}","created_at":"2015-06-13T21:05:47Z","updated_at":"2015-06-13T21:05:51Z","pushed_at":"2015-06-13T22:03:59Z","git_url":"git://github.com/petermora/Nim.git","ssh_url":"git@github.com:petermora/Nim.git","clone_url":"https://github.com/petermora/Nim.git","svn_url":"https://github.com/petermora/Nim","homepage":"http://nim-lang.org/","size":39153,"stargazers_count":0,"watchers_count":0,"language":"Nimrod","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"devel"}},"base":{"label":"nim-lang:devel","ref":"devel","sha":"2782cddb56b2f3b56893915bc227839dc3d246c0","user":{"login":"nim-lang","id":603863,"avatar_url":"https://avatars.githubusercontent.com/u/603863?v=3","gravatar_id":"","url":"https://api.github.com/users/nim-lang","html_url":"https://github.com/nim-lang","followers_url":"https://api.github.com/users/nim-lang/followers","following_url":"https://api.github.com/users/nim-lang/following{/other_user}","gists_url":"https://api.github.com/users/nim-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/nim-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nim-lang/subscriptions","organizations_url":"https://api.github.com/users/nim-lang/orgs","repos_url":"https://api.github.com/users/nim-lang/repos","events_url":"https://api.github.com/users/nim-lang/events{/privacy}","received_events_url":"https://api.github.com/users/nim-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":842037,"name":"Nim","full_name":"nim-lang/Nim","owner":{"login":"nim-lang","id":603863,"avatar_url":"https://avatars.githubusercontent.com/u/603863?v=3","gravatar_id":"","url":"https://api.github.com/users/nim-lang","html_url":"https://github.com/nim-lang","followers_url":"https://api.github.com/users/nim-lang/followers","following_url":"https://api.github.com/users/nim-lang/following{/other_user}","gists_url":"https://api.github.com/users/nim-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/nim-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nim-lang/subscriptions","organizations_url":"https://api.github.com/users/nim-lang/orgs","repos_url":"https://api.github.com/users/nim-lang/repos","events_url":"https://api.github.com/users/nim-lang/events{/privacy}","received_events_url":"https://api.github.com/users/nim-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nim-lang/Nim","description":"Nim (formerly known as \"Nimrod\") is a compiled, garbage-collected systems programming language which has an excellent productivity/performance ratio. Nim's design focuses on efficiency, expressiveness, elegance (in the order of priority).","fork":false,"url":"https://api.github.com/repos/nim-lang/Nim","forks_url":"https://api.github.com/repos/nim-lang/Nim/forks","keys_url":"https://api.github.com/repos/nim-lang/Nim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nim-lang/Nim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nim-lang/Nim/teams","hooks_url":"https://api.github.com/repos/nim-lang/Nim/hooks","issue_events_url":"https://api.github.com/repos/nim-lang/Nim/issues/events{/number}","events_url":"https://api.github.com/repos/nim-lang/Nim/events","assignees_url":"https://api.github.com/repos/nim-lang/Nim/assignees{/user}","branches_url":"https://api.github.com/repos/nim-lang/Nim/branches{/branch}","tags_url":"https://api.github.com/repos/nim-lang/Nim/tags","blobs_url":"https://api.github.com/repos/nim-lang/Nim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nim-lang/Nim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nim-lang/Nim/git/refs{/sha}","trees_url":"https://api.github.com/repos/nim-lang/Nim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nim-lang/Nim/statuses/{sha}","languages_url":"https://api.github.com/repos/nim-lang/Nim/languages","stargazers_url":"https://api.github.com/repos/nim-lang/Nim/stargazers","contributors_url":"https://api.github.com/repos/nim-lang/Nim/contributors","subscribers_url":"https://api.github.com/repos/nim-lang/Nim/subscribers","subscription_url":"https://api.github.com/repos/nim-lang/Nim/subscription","commits_url":"https://api.github.com/repos/nim-lang/Nim/commits{/sha}","git_commits_url":"https://api.github.com/repos/nim-lang/Nim/git/commits{/sha}","comments_url":"https://api.github.com/repos/nim-lang/Nim/comments{/number}","issue_comment_url":"https://api.github.com/repos/nim-lang/Nim/issues/comments{/number}","contents_url":"https://api.github.com/repos/nim-lang/Nim/contents/{+path}","compare_url":"https://api.github.com/repos/nim-lang/Nim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nim-lang/Nim/merges","archive_url":"https://api.github.com/repos/nim-lang/Nim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nim-lang/Nim/downloads","issues_url":"https://api.github.com/repos/nim-lang/Nim/issues{/number}","pulls_url":"https://api.github.com/repos/nim-lang/Nim/pulls{/number}","milestones_url":"https://api.github.com/repos/nim-lang/Nim/milestones{/number}","notifications_url":"https://api.github.com/repos/nim-lang/Nim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nim-lang/Nim/labels{/name}","releases_url":"https://api.github.com/repos/nim-lang/Nim/releases{/id}","created_at":"2010-08-16T20:38:58Z","updated_at":"2015-06-15T08:04:24Z","pushed_at":"2015-06-15T07:21:58Z","git_url":"git://github.com/nim-lang/Nim.git","ssh_url":"git@github.com:nim-lang/Nim.git","clone_url":"https://github.com/nim-lang/Nim.git","svn_url":"https://github.com/nim-lang/Nim","homepage":"http://nim-lang.org/","size":352145,"stargazers_count":2103,"watchers_count":2103,"language":"Nimrod","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":278,"mirror_url":null,"open_issues_count":561,"forks":278,"open_issues":561,"watchers":2103,"default_branch":"devel"}},"_links":{"self":{"href":"https://api.github.com/repos/nim-lang/Nim/pulls/2918"},"html":{"href":"https://github.com/nim-lang/Nim/pull/2918"},"issue":{"href":"https://api.github.com/repos/nim-lang/Nim/issues/2918"},"comments":{"href":"https://api.github.com/repos/nim-lang/Nim/issues/2918/comments"},"review_comments":{"href":"https://api.github.com/repos/nim-lang/Nim/pulls/2918/comments"},"review_comment":{"href":"https://api.github.com/repos/nim-lang/Nim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nim-lang/Nim/pulls/2918/commits"},"statuses":{"href":"https://api.github.com/repos/nim-lang/Nim/statuses/d159bdf7b06c19f0b06014396185755427d936cd"}}}}