{"action":"created","comment":{"url":"https://api.github.com/repos/xitu/gold-miner/pulls/comments/86564422","pull_request_review_id":7214145,"id":86564422,"diff_hunk":"@@ -308,37 +248,25 @@ Here’s how it runs:\n     sumRange 11 10 55 =    -- 11 > 10 => 55\n     55\n \n-You’re probably thinking that **_for_** loops are easier to understand. While that’s debatable and more likely an issue of **_familiarity_**, non-recursive loops require Mutability, which is bad.\n-\n-I haven’t entirely explained the benefits of Immutability here but check out the **_Global Mutable State_** section in [Why Programmers Need Limits](https://medium.com/@cscalfani/why-programmers-need-limits-3d96e1a0a6db) to learn more.\n-\n-One obvious benefit is that if you have access to a value in your program, you only have read access, which means that no one else can change that value. Even you. So no accidental mutations.\n-\n-Also, if your program is multi-threaded, then no other thread can pull the rug out from under you. That value is constant and if another thread wants to change it, it’ll have create a new value from the old one.\n-\n-Back in the mid 90s, I wrote a Game Engine for [Creature Crunch](https://www.youtube.com/watch?v=uIOYSjBRORM) and the biggest source of bugs was multithreading issues. I wish I knew about immutability back then. But back then I was more worried about the difference between a 2x or 4x speed CD-ROM drives on game performance.\n-\n-> Immutability creates simpler and safer code.\n-\n-#### My Brain!!!!\n-\n-\n+你可能认为 **_for_** 循环更好理解。这是有争议的，而且更多是因为我们更**_熟悉_** for 循环。这种非递归实现的循环需要可变变量，更糟糕。\n \n+我在这里没有讲完不可变性的全部好处，更多内容请参阅[为什么程序员需要限制]((https://medium.com/@cscalfani/why-programmers-need-limits-3d96e1a0a6db))一文中的**_全局可变状态_**一节。\n \n+不过一个显而易见的好处就是，在程序中给一个变量赋值后就只能读，这也就是说着再也没人能改变这个值，哪怕是你自己。所以省去了很多意想不到的麻烦。","path":"TODO/so-you-want-to-be-a-functional-programmer-part-1.md","position":396,"original_position":398,"commit_id":"01ac1c19783b69c3a21ad76a68eff6d10f0bbe2c","original_commit_id":"01ac1c19783b69c3a21ad76a68eff6d10f0bbe2c","user":{"login":"luoyaqifei","id":7871246,"avatar_url":"https://avatars.githubusercontent.com/u/7871246?v=3","gravatar_id":"","url":"https://api.github.com/users/luoyaqifei","html_url":"https://github.com/luoyaqifei","followers_url":"https://api.github.com/users/luoyaqifei/followers","following_url":"https://api.github.com/users/luoyaqifei/following{/other_user}","gists_url":"https://api.github.com/users/luoyaqifei/gists{/gist_id}","starred_url":"https://api.github.com/users/luoyaqifei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luoyaqifei/subscriptions","organizations_url":"https://api.github.com/users/luoyaqifei/orgs","repos_url":"https://api.github.com/users/luoyaqifei/repos","events_url":"https://api.github.com/users/luoyaqifei/events{/privacy}","received_events_url":"https://api.github.com/users/luoyaqifei/received_events","type":"User","site_admin":false},"body":"> 在程序中给一个变量赋值后就只能读，\r\n\r\n如果你对你的程序中的变量有访问权限，有的只是只读权限，","created_at":"2016-11-04T15:06:47Z","updated_at":"2016-11-04T15:07:40Z","html_url":"https://github.com/xitu/gold-miner/pull/889#discussion_r86564422","pull_request_url":"https://api.github.com/repos/xitu/gold-miner/pulls/889","_links":{"self":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/comments/86564422"},"html":{"href":"https://github.com/xitu/gold-miner/pull/889#discussion_r86564422"},"pull_request":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/889"}}},"pull_request":{"url":"https://api.github.com/repos/xitu/gold-miner/pulls/889","id":92037673,"html_url":"https://github.com/xitu/gold-miner/pull/889","diff_url":"https://github.com/xitu/gold-miner/pull/889.diff","patch_url":"https://github.com/xitu/gold-miner/pull/889.patch","issue_url":"https://api.github.com/repos/xitu/gold-miner/issues/889","number":889,"state":"open","locked":false,"title":"准备充分了嘛就想学函数式编程？(Part 1)","user":{"login":"cdpath","id":11472839,"avatar_url":"https://avatars.githubusercontent.com/u/11472839?v=3","gravatar_id":"","url":"https://api.github.com/users/cdpath","html_url":"https://github.com/cdpath","followers_url":"https://api.github.com/users/cdpath/followers","following_url":"https://api.github.com/users/cdpath/following{/other_user}","gists_url":"https://api.github.com/users/cdpath/gists{/gist_id}","starred_url":"https://api.github.com/users/cdpath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdpath/subscriptions","organizations_url":"https://api.github.com/users/cdpath/orgs","repos_url":"https://api.github.com/users/cdpath/repos","events_url":"https://api.github.com/users/cdpath/events{/privacy}","received_events_url":"https://api.github.com/users/cdpath/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-11-02T19:19:15Z","updated_at":"2016-11-04T15:07:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"42f6edf57476cdf2e42c69745a768cb16f6a77a9","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/xitu/gold-miner/pulls/889/commits","review_comments_url":"https://api.github.com/repos/xitu/gold-miner/pulls/889/comments","review_comment_url":"https://api.github.com/repos/xitu/gold-miner/pulls/comments{/number}","comments_url":"https://api.github.com/repos/xitu/gold-miner/issues/889/comments","statuses_url":"https://api.github.com/repos/xitu/gold-miner/statuses/01ac1c19783b69c3a21ad76a68eff6d10f0bbe2c","head":{"label":"cdpath:patch-3","ref":"patch-3","sha":"01ac1c19783b69c3a21ad76a68eff6d10f0bbe2c","user":{"login":"cdpath","id":11472839,"avatar_url":"https://avatars.githubusercontent.com/u/11472839?v=3","gravatar_id":"","url":"https://api.github.com/users/cdpath","html_url":"https://github.com/cdpath","followers_url":"https://api.github.com/users/cdpath/followers","following_url":"https://api.github.com/users/cdpath/following{/other_user}","gists_url":"https://api.github.com/users/cdpath/gists{/gist_id}","starred_url":"https://api.github.com/users/cdpath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdpath/subscriptions","organizations_url":"https://api.github.com/users/cdpath/orgs","repos_url":"https://api.github.com/users/cdpath/repos","events_url":"https://api.github.com/users/cdpath/events{/privacy}","received_events_url":"https://api.github.com/users/cdpath/received_events","type":"User","site_admin":false},"repo":{"id":48601740,"name":"gold-miner","full_name":"cdpath/gold-miner","owner":{"login":"cdpath","id":11472839,"avatar_url":"https://avatars.githubusercontent.com/u/11472839?v=3","gravatar_id":"","url":"https://api.github.com/users/cdpath","html_url":"https://github.com/cdpath","followers_url":"https://api.github.com/users/cdpath/followers","following_url":"https://api.github.com/users/cdpath/following{/other_user}","gists_url":"https://api.github.com/users/cdpath/gists{/gist_id}","starred_url":"https://api.github.com/users/cdpath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdpath/subscriptions","organizations_url":"https://api.github.com/users/cdpath/orgs","repos_url":"https://api.github.com/users/cdpath/repos","events_url":"https://api.github.com/users/cdpath/events{/privacy}","received_events_url":"https://api.github.com/users/cdpath/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cdpath/gold-miner","description":"掘金翻译计划，翻译掘金上优质的英文文章","fork":true,"url":"https://api.github.com/repos/cdpath/gold-miner","forks_url":"https://api.github.com/repos/cdpath/gold-miner/forks","keys_url":"https://api.github.com/repos/cdpath/gold-miner/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cdpath/gold-miner/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cdpath/gold-miner/teams","hooks_url":"https://api.github.com/repos/cdpath/gold-miner/hooks","issue_events_url":"https://api.github.com/repos/cdpath/gold-miner/issues/events{/number}","events_url":"https://api.github.com/repos/cdpath/gold-miner/events","assignees_url":"https://api.github.com/repos/cdpath/gold-miner/assignees{/user}","branches_url":"https://api.github.com/repos/cdpath/gold-miner/branches{/branch}","tags_url":"https://api.github.com/repos/cdpath/gold-miner/tags","blobs_url":"https://api.github.com/repos/cdpath/gold-miner/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cdpath/gold-miner/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cdpath/gold-miner/git/refs{/sha}","trees_url":"https://api.github.com/repos/cdpath/gold-miner/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cdpath/gold-miner/statuses/{sha}","languages_url":"https://api.github.com/repos/cdpath/gold-miner/languages","stargazers_url":"https://api.github.com/repos/cdpath/gold-miner/stargazers","contributors_url":"https://api.github.com/repos/cdpath/gold-miner/contributors","subscribers_url":"https://api.github.com/repos/cdpath/gold-miner/subscribers","subscription_url":"https://api.github.com/repos/cdpath/gold-miner/subscription","commits_url":"https://api.github.com/repos/cdpath/gold-miner/commits{/sha}","git_commits_url":"https://api.github.com/repos/cdpath/gold-miner/git/commits{/sha}","comments_url":"https://api.github.com/repos/cdpath/gold-miner/comments{/number}","issue_comment_url":"https://api.github.com/repos/cdpath/gold-miner/issues/comments{/number}","contents_url":"https://api.github.com/repos/cdpath/gold-miner/contents/{+path}","compare_url":"https://api.github.com/repos/cdpath/gold-miner/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cdpath/gold-miner/merges","archive_url":"https://api.github.com/repos/cdpath/gold-miner/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cdpath/gold-miner/downloads","issues_url":"https://api.github.com/repos/cdpath/gold-miner/issues{/number}","pulls_url":"https://api.github.com/repos/cdpath/gold-miner/pulls{/number}","milestones_url":"https://api.github.com/repos/cdpath/gold-miner/milestones{/number}","notifications_url":"https://api.github.com/repos/cdpath/gold-miner/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cdpath/gold-miner/labels{/name}","releases_url":"https://api.github.com/repos/cdpath/gold-miner/releases{/id}","deployments_url":"https://api.github.com/repos/cdpath/gold-miner/deployments","created_at":"2015-12-26T06:32:59Z","updated_at":"2015-12-26T06:05:39Z","pushed_at":"2016-11-02T19:18:42Z","git_url":"git://github.com/cdpath/gold-miner.git","ssh_url":"git@github.com:cdpath/gold-miner.git","clone_url":"https://github.com/cdpath/gold-miner.git","svn_url":"https://github.com/cdpath/gold-miner","homepage":"http://gold.xitu.io","size":16275,"stargazers_count":0,"watchers_count":0,"language":null,"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":"master"}},"base":{"label":"xitu:master","ref":"master","sha":"64a930cb9627854eb0ab4977d4cdf478189fc3fc","user":{"login":"xitu","id":10482599,"avatar_url":"https://avatars.githubusercontent.com/u/10482599?v=3","gravatar_id":"","url":"https://api.github.com/users/xitu","html_url":"https://github.com/xitu","followers_url":"https://api.github.com/users/xitu/followers","following_url":"https://api.github.com/users/xitu/following{/other_user}","gists_url":"https://api.github.com/users/xitu/gists{/gist_id}","starred_url":"https://api.github.com/users/xitu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xitu/subscriptions","organizations_url":"https://api.github.com/users/xitu/orgs","repos_url":"https://api.github.com/users/xitu/repos","events_url":"https://api.github.com/users/xitu/events{/privacy}","received_events_url":"https://api.github.com/users/xitu/received_events","type":"Organization","site_admin":false},"repo":{"id":45512989,"name":"gold-miner","full_name":"xitu/gold-miner","owner":{"login":"xitu","id":10482599,"avatar_url":"https://avatars.githubusercontent.com/u/10482599?v=3","gravatar_id":"","url":"https://api.github.com/users/xitu","html_url":"https://github.com/xitu","followers_url":"https://api.github.com/users/xitu/followers","following_url":"https://api.github.com/users/xitu/following{/other_user}","gists_url":"https://api.github.com/users/xitu/gists{/gist_id}","starred_url":"https://api.github.com/users/xitu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xitu/subscriptions","organizations_url":"https://api.github.com/users/xitu/orgs","repos_url":"https://api.github.com/users/xitu/repos","events_url":"https://api.github.com/users/xitu/events{/privacy}","received_events_url":"https://api.github.com/users/xitu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/xitu/gold-miner","description":"掘金翻译计划，翻译掘金上优质的英文文章","fork":false,"url":"https://api.github.com/repos/xitu/gold-miner","forks_url":"https://api.github.com/repos/xitu/gold-miner/forks","keys_url":"https://api.github.com/repos/xitu/gold-miner/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xitu/gold-miner/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xitu/gold-miner/teams","hooks_url":"https://api.github.com/repos/xitu/gold-miner/hooks","issue_events_url":"https://api.github.com/repos/xitu/gold-miner/issues/events{/number}","events_url":"https://api.github.com/repos/xitu/gold-miner/events","assignees_url":"https://api.github.com/repos/xitu/gold-miner/assignees{/user}","branches_url":"https://api.github.com/repos/xitu/gold-miner/branches{/branch}","tags_url":"https://api.github.com/repos/xitu/gold-miner/tags","blobs_url":"https://api.github.com/repos/xitu/gold-miner/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xitu/gold-miner/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xitu/gold-miner/git/refs{/sha}","trees_url":"https://api.github.com/repos/xitu/gold-miner/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xitu/gold-miner/statuses/{sha}","languages_url":"https://api.github.com/repos/xitu/gold-miner/languages","stargazers_url":"https://api.github.com/repos/xitu/gold-miner/stargazers","contributors_url":"https://api.github.com/repos/xitu/gold-miner/contributors","subscribers_url":"https://api.github.com/repos/xitu/gold-miner/subscribers","subscription_url":"https://api.github.com/repos/xitu/gold-miner/subscription","commits_url":"https://api.github.com/repos/xitu/gold-miner/commits{/sha}","git_commits_url":"https://api.github.com/repos/xitu/gold-miner/git/commits{/sha}","comments_url":"https://api.github.com/repos/xitu/gold-miner/comments{/number}","issue_comment_url":"https://api.github.com/repos/xitu/gold-miner/issues/comments{/number}","contents_url":"https://api.github.com/repos/xitu/gold-miner/contents/{+path}","compare_url":"https://api.github.com/repos/xitu/gold-miner/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xitu/gold-miner/merges","archive_url":"https://api.github.com/repos/xitu/gold-miner/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xitu/gold-miner/downloads","issues_url":"https://api.github.com/repos/xitu/gold-miner/issues{/number}","pulls_url":"https://api.github.com/repos/xitu/gold-miner/pulls{/number}","milestones_url":"https://api.github.com/repos/xitu/gold-miner/milestones{/number}","notifications_url":"https://api.github.com/repos/xitu/gold-miner/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xitu/gold-miner/labels{/name}","releases_url":"https://api.github.com/repos/xitu/gold-miner/releases{/id}","deployments_url":"https://api.github.com/repos/xitu/gold-miner/deployments","created_at":"2015-11-04T03:29:13Z","updated_at":"2016-11-04T13:25:15Z","pushed_at":"2016-11-04T12:49:06Z","git_url":"git://github.com/xitu/gold-miner.git","ssh_url":"git@github.com:xitu/gold-miner.git","clone_url":"https://github.com/xitu/gold-miner.git","svn_url":"https://github.com/xitu/gold-miner","homepage":"http://gold.xitu.io","size":17024,"stargazers_count":4677,"watchers_count":4677,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":863,"mirror_url":null,"open_issues_count":32,"forks":863,"open_issues":32,"watchers":4677,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/889"},"html":{"href":"https://github.com/xitu/gold-miner/pull/889"},"issue":{"href":"https://api.github.com/repos/xitu/gold-miner/issues/889"},"comments":{"href":"https://api.github.com/repos/xitu/gold-miner/issues/889/comments"},"review_comments":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/889/comments"},"review_comment":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/889/commits"},"statuses":{"href":"https://api.github.com/repos/xitu/gold-miner/statuses/01ac1c19783b69c3a21ad76a68eff6d10f0bbe2c"}}}}
{"actor":{"display_login":"luoyaqifei"}}