{"action":"created","comment":{"url":"https://api.github.com/repos/socraticorg/mathjs/pulls/comments/77234151","id":77234151,"diff_hunk":"@@ -50,11 +51,29 @@ function removeUnnecessaryParens(nodeContext) {\n \n   switch (node.type) {\n     case 'OperatorNode':\n-      getNodeChildrenWithContext(node).forEach(\n-        child => removeUnnecessaryParens(child));\n+      getNodeChildrenWithContext(node).forEach(child => removeUnnecessaryParens(child));\n+      // Sometimes, parens are around expressions that have been simplified\n+      // all they can be. If that expression is part of an addition\n+      // operation, we can remove the parenthesis.\n+      // e.g. (x+4) + (12+7) -> x+4 + 12+7\n+      if (node.op === '+') {\n+        node.args.forEach((child, i) => {\n+          if (child.type === 'ParenthesisNode' &&\n+              child.content.type === 'OperatorNode' &&\n+              !canCollectLikeTerms(child.content) &&\n+              !canResolveMath(child.content) &&\n+              !canAddPolynomialNodes(child.content.args) &&\n+              !canMultiplyLikeTermPolynomialNodes(child.content.args)) {\n+            // get rid of the parens\n+            node.args[i] = child.content;","path":"lib/expression/step-solver/stepper.js","position":28,"original_position":28,"commit_id":"e8349b69b89053c91ac613359fdc01e22fa5d63d","original_commit_id":"e8349b69b89053c91ac613359fdc01e22fa5d63d","user":{"login":"aelnaiem","id":786569,"avatar_url":"https://avatars.githubusercontent.com/u/786569?v=3","gravatar_id":"","url":"https://api.github.com/users/aelnaiem","html_url":"https://github.com/aelnaiem","followers_url":"https://api.github.com/users/aelnaiem/followers","following_url":"https://api.github.com/users/aelnaiem/following{/other_user}","gists_url":"https://api.github.com/users/aelnaiem/gists{/gist_id}","starred_url":"https://api.github.com/users/aelnaiem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aelnaiem/subscriptions","organizations_url":"https://api.github.com/users/aelnaiem/orgs","repos_url":"https://api.github.com/users/aelnaiem/repos","events_url":"https://api.github.com/users/aelnaiem/events{/privacy}","received_events_url":"https://api.github.com/users/aelnaiem/received_events","type":"User","site_admin":false},"body":"maybe make this a node context, or some other way to make it easier to explain that we're replacing a node to get rid of the parens - and then call a function to do this","created_at":"2016-09-01T19:02:34Z","updated_at":"2016-09-01T19:02:34Z","html_url":"https://github.com/socraticorg/mathjs/pull/5#discussion_r77234151","pull_request_url":"https://api.github.com/repos/socraticorg/mathjs/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/socraticorg/mathjs/pulls/comments/77234151"},"html":{"href":"https://github.com/socraticorg/mathjs/pull/5#discussion_r77234151"},"pull_request":{"href":"https://api.github.com/repos/socraticorg/mathjs/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/socraticorg/mathjs/pulls/5","id":83486163,"html_url":"https://github.com/socraticorg/mathjs/pull/5","diff_url":"https://github.com/socraticorg/mathjs/pull/5.diff","patch_url":"https://github.com/socraticorg/mathjs/pull/5.patch","issue_url":"https://api.github.com/repos/socraticorg/mathjs/issues/5","number":5,"state":"open","locked":false,"title":"combine like terms for multiplication","user":{"login":"evykassirer","id":5634097,"avatar_url":"https://avatars.githubusercontent.com/u/5634097?v=3","gravatar_id":"","url":"https://api.github.com/users/evykassirer","html_url":"https://github.com/evykassirer","followers_url":"https://api.github.com/users/evykassirer/followers","following_url":"https://api.github.com/users/evykassirer/following{/other_user}","gists_url":"https://api.github.com/users/evykassirer/gists{/gist_id}","starred_url":"https://api.github.com/users/evykassirer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evykassirer/subscriptions","organizations_url":"https://api.github.com/users/evykassirer/orgs","repos_url":"https://api.github.com/users/evykassirer/repos","events_url":"https://api.github.com/users/evykassirer/events{/privacy}","received_events_url":"https://api.github.com/users/evykassirer/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-08-31T16:29:34Z","updated_at":"2016-09-01T19:02:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a91fe559dcd5858086d2edaf86db87940d09a321","assignee":{"login":"aelnaiem","id":786569,"avatar_url":"https://avatars.githubusercontent.com/u/786569?v=3","gravatar_id":"","url":"https://api.github.com/users/aelnaiem","html_url":"https://github.com/aelnaiem","followers_url":"https://api.github.com/users/aelnaiem/followers","following_url":"https://api.github.com/users/aelnaiem/following{/other_user}","gists_url":"https://api.github.com/users/aelnaiem/gists{/gist_id}","starred_url":"https://api.github.com/users/aelnaiem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aelnaiem/subscriptions","organizations_url":"https://api.github.com/users/aelnaiem/orgs","repos_url":"https://api.github.com/users/aelnaiem/repos","events_url":"https://api.github.com/users/aelnaiem/events{/privacy}","received_events_url":"https://api.github.com/users/aelnaiem/received_events","type":"User","site_admin":false},"assignees":[{"login":"aelnaiem","id":786569,"avatar_url":"https://avatars.githubusercontent.com/u/786569?v=3","gravatar_id":"","url":"https://api.github.com/users/aelnaiem","html_url":"https://github.com/aelnaiem","followers_url":"https://api.github.com/users/aelnaiem/followers","following_url":"https://api.github.com/users/aelnaiem/following{/other_user}","gists_url":"https://api.github.com/users/aelnaiem/gists{/gist_id}","starred_url":"https://api.github.com/users/aelnaiem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aelnaiem/subscriptions","organizations_url":"https://api.github.com/users/aelnaiem/orgs","repos_url":"https://api.github.com/users/aelnaiem/repos","events_url":"https://api.github.com/users/aelnaiem/events{/privacy}","received_events_url":"https://api.github.com/users/aelnaiem/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/socraticorg/mathjs/pulls/5/commits","review_comments_url":"https://api.github.com/repos/socraticorg/mathjs/pulls/5/comments","review_comment_url":"https://api.github.com/repos/socraticorg/mathjs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/socraticorg/mathjs/issues/5/comments","statuses_url":"https://api.github.com/repos/socraticorg/mathjs/statuses/e8349b69b89053c91ac613359fdc01e22fa5d63d","head":{"label":"socraticorg:collect_like_terms","ref":"collect_like_terms","sha":"e8349b69b89053c91ac613359fdc01e22fa5d63d","user":{"login":"socraticorg","id":4368132,"avatar_url":"https://avatars.githubusercontent.com/u/4368132?v=3","gravatar_id":"","url":"https://api.github.com/users/socraticorg","html_url":"https://github.com/socraticorg","followers_url":"https://api.github.com/users/socraticorg/followers","following_url":"https://api.github.com/users/socraticorg/following{/other_user}","gists_url":"https://api.github.com/users/socraticorg/gists{/gist_id}","starred_url":"https://api.github.com/users/socraticorg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/socraticorg/subscriptions","organizations_url":"https://api.github.com/users/socraticorg/orgs","repos_url":"https://api.github.com/users/socraticorg/repos","events_url":"https://api.github.com/users/socraticorg/events{/privacy}","received_events_url":"https://api.github.com/users/socraticorg/received_events","type":"Organization","site_admin":false},"repo":{"id":66677351,"name":"mathjs","full_name":"socraticorg/mathjs","owner":{"login":"socraticorg","id":4368132,"avatar_url":"https://avatars.githubusercontent.com/u/4368132?v=3","gravatar_id":"","url":"https://api.github.com/users/socraticorg","html_url":"https://github.com/socraticorg","followers_url":"https://api.github.com/users/socraticorg/followers","following_url":"https://api.github.com/users/socraticorg/following{/other_user}","gists_url":"https://api.github.com/users/socraticorg/gists{/gist_id}","starred_url":"https://api.github.com/users/socraticorg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/socraticorg/subscriptions","organizations_url":"https://api.github.com/users/socraticorg/orgs","repos_url":"https://api.github.com/users/socraticorg/repos","events_url":"https://api.github.com/users/socraticorg/events{/privacy}","received_events_url":"https://api.github.com/users/socraticorg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/socraticorg/mathjs","description":"An extensive math library for JavaScript and Node.js","fork":true,"url":"https://api.github.com/repos/socraticorg/mathjs","forks_url":"https://api.github.com/repos/socraticorg/mathjs/forks","keys_url":"https://api.github.com/repos/socraticorg/mathjs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/socraticorg/mathjs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/socraticorg/mathjs/teams","hooks_url":"https://api.github.com/repos/socraticorg/mathjs/hooks","issue_events_url":"https://api.github.com/repos/socraticorg/mathjs/issues/events{/number}","events_url":"https://api.github.com/repos/socraticorg/mathjs/events","assignees_url":"https://api.github.com/repos/socraticorg/mathjs/assignees{/user}","branches_url":"https://api.github.com/repos/socraticorg/mathjs/branches{/branch}","tags_url":"https://api.github.com/repos/socraticorg/mathjs/tags","blobs_url":"https://api.github.com/repos/socraticorg/mathjs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/socraticorg/mathjs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/socraticorg/mathjs/git/refs{/sha}","trees_url":"https://api.github.com/repos/socraticorg/mathjs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/socraticorg/mathjs/statuses/{sha}","languages_url":"https://api.github.com/repos/socraticorg/mathjs/languages","stargazers_url":"https://api.github.com/repos/socraticorg/mathjs/stargazers","contributors_url":"https://api.github.com/repos/socraticorg/mathjs/contributors","subscribers_url":"https://api.github.com/repos/socraticorg/mathjs/subscribers","subscription_url":"https://api.github.com/repos/socraticorg/mathjs/subscription","commits_url":"https://api.github.com/repos/socraticorg/mathjs/commits{/sha}","git_commits_url":"https://api.github.com/repos/socraticorg/mathjs/git/commits{/sha}","comments_url":"https://api.github.com/repos/socraticorg/mathjs/comments{/number}","issue_comment_url":"https://api.github.com/repos/socraticorg/mathjs/issues/comments{/number}","contents_url":"https://api.github.com/repos/socraticorg/mathjs/contents/{+path}","compare_url":"https://api.github.com/repos/socraticorg/mathjs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/socraticorg/mathjs/merges","archive_url":"https://api.github.com/repos/socraticorg/mathjs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/socraticorg/mathjs/downloads","issues_url":"https://api.github.com/repos/socraticorg/mathjs/issues{/number}","pulls_url":"https://api.github.com/repos/socraticorg/mathjs/pulls{/number}","milestones_url":"https://api.github.com/repos/socraticorg/mathjs/milestones{/number}","notifications_url":"https://api.github.com/repos/socraticorg/mathjs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/socraticorg/mathjs/labels{/name}","releases_url":"https://api.github.com/repos/socraticorg/mathjs/releases{/id}","deployments_url":"https://api.github.com/repos/socraticorg/mathjs/deployments","created_at":"2016-08-26T20:28:50Z","updated_at":"2016-08-26T20:28:52Z","pushed_at":"2016-09-01T18:53:58Z","git_url":"git://github.com/socraticorg/mathjs.git","ssh_url":"git@github.com:socraticorg/mathjs.git","clone_url":"https://github.com/socraticorg/mathjs.git","svn_url":"https://github.com/socraticorg/mathjs","homepage":"mathjs.org","size":32131,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"socraticorg:ek-mathsteps","ref":"ek-mathsteps","sha":"1856f6ba2eef034b8e2e03276767df50d064c2e6","user":{"login":"socraticorg","id":4368132,"avatar_url":"https://avatars.githubusercontent.com/u/4368132?v=3","gravatar_id":"","url":"https://api.github.com/users/socraticorg","html_url":"https://github.com/socraticorg","followers_url":"https://api.github.com/users/socraticorg/followers","following_url":"https://api.github.com/users/socraticorg/following{/other_user}","gists_url":"https://api.github.com/users/socraticorg/gists{/gist_id}","starred_url":"https://api.github.com/users/socraticorg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/socraticorg/subscriptions","organizations_url":"https://api.github.com/users/socraticorg/orgs","repos_url":"https://api.github.com/users/socraticorg/repos","events_url":"https://api.github.com/users/socraticorg/events{/privacy}","received_events_url":"https://api.github.com/users/socraticorg/received_events","type":"Organization","site_admin":false},"repo":{"id":66677351,"name":"mathjs","full_name":"socraticorg/mathjs","owner":{"login":"socraticorg","id":4368132,"avatar_url":"https://avatars.githubusercontent.com/u/4368132?v=3","gravatar_id":"","url":"https://api.github.com/users/socraticorg","html_url":"https://github.com/socraticorg","followers_url":"https://api.github.com/users/socraticorg/followers","following_url":"https://api.github.com/users/socraticorg/following{/other_user}","gists_url":"https://api.github.com/users/socraticorg/gists{/gist_id}","starred_url":"https://api.github.com/users/socraticorg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/socraticorg/subscriptions","organizations_url":"https://api.github.com/users/socraticorg/orgs","repos_url":"https://api.github.com/users/socraticorg/repos","events_url":"https://api.github.com/users/socraticorg/events{/privacy}","received_events_url":"https://api.github.com/users/socraticorg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/socraticorg/mathjs","description":"An extensive math library for JavaScript and Node.js","fork":true,"url":"https://api.github.com/repos/socraticorg/mathjs","forks_url":"https://api.github.com/repos/socraticorg/mathjs/forks","keys_url":"https://api.github.com/repos/socraticorg/mathjs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/socraticorg/mathjs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/socraticorg/mathjs/teams","hooks_url":"https://api.github.com/repos/socraticorg/mathjs/hooks","issue_events_url":"https://api.github.com/repos/socraticorg/mathjs/issues/events{/number}","events_url":"https://api.github.com/repos/socraticorg/mathjs/events","assignees_url":"https://api.github.com/repos/socraticorg/mathjs/assignees{/user}","branches_url":"https://api.github.com/repos/socraticorg/mathjs/branches{/branch}","tags_url":"https://api.github.com/repos/socraticorg/mathjs/tags","blobs_url":"https://api.github.com/repos/socraticorg/mathjs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/socraticorg/mathjs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/socraticorg/mathjs/git/refs{/sha}","trees_url":"https://api.github.com/repos/socraticorg/mathjs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/socraticorg/mathjs/statuses/{sha}","languages_url":"https://api.github.com/repos/socraticorg/mathjs/languages","stargazers_url":"https://api.github.com/repos/socraticorg/mathjs/stargazers","contributors_url":"https://api.github.com/repos/socraticorg/mathjs/contributors","subscribers_url":"https://api.github.com/repos/socraticorg/mathjs/subscribers","subscription_url":"https://api.github.com/repos/socraticorg/mathjs/subscription","commits_url":"https://api.github.com/repos/socraticorg/mathjs/commits{/sha}","git_commits_url":"https://api.github.com/repos/socraticorg/mathjs/git/commits{/sha}","comments_url":"https://api.github.com/repos/socraticorg/mathjs/comments{/number}","issue_comment_url":"https://api.github.com/repos/socraticorg/mathjs/issues/comments{/number}","contents_url":"https://api.github.com/repos/socraticorg/mathjs/contents/{+path}","compare_url":"https://api.github.com/repos/socraticorg/mathjs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/socraticorg/mathjs/merges","archive_url":"https://api.github.com/repos/socraticorg/mathjs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/socraticorg/mathjs/downloads","issues_url":"https://api.github.com/repos/socraticorg/mathjs/issues{/number}","pulls_url":"https://api.github.com/repos/socraticorg/mathjs/pulls{/number}","milestones_url":"https://api.github.com/repos/socraticorg/mathjs/milestones{/number}","notifications_url":"https://api.github.com/repos/socraticorg/mathjs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/socraticorg/mathjs/labels{/name}","releases_url":"https://api.github.com/repos/socraticorg/mathjs/releases{/id}","deployments_url":"https://api.github.com/repos/socraticorg/mathjs/deployments","created_at":"2016-08-26T20:28:50Z","updated_at":"2016-08-26T20:28:52Z","pushed_at":"2016-09-01T18:53:58Z","git_url":"git://github.com/socraticorg/mathjs.git","ssh_url":"git@github.com:socraticorg/mathjs.git","clone_url":"https://github.com/socraticorg/mathjs.git","svn_url":"https://github.com/socraticorg/mathjs","homepage":"mathjs.org","size":32131,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/socraticorg/mathjs/pulls/5"},"html":{"href":"https://github.com/socraticorg/mathjs/pull/5"},"issue":{"href":"https://api.github.com/repos/socraticorg/mathjs/issues/5"},"comments":{"href":"https://api.github.com/repos/socraticorg/mathjs/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/socraticorg/mathjs/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/socraticorg/mathjs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/socraticorg/mathjs/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/socraticorg/mathjs/statuses/e8349b69b89053c91ac613359fdc01e22fa5d63d"}}}}
{"actor":{"display_login":"aelnaiem"}}