{"action":"created","comment":{"url":"https://api.github.com/repos/socraticorg/mathjs/pulls/comments/81370084","pull_request_review_id":2356290,"id":81370084,"diff_hunk":"@@ -88,32 +147,126 @@ function performArithmetic(node) {\n   }\n }\n \n+// If `node` is an addition node with 0 as one of its operands,\n+// remove 0 from the operands list. Returns a NodeStatus object.\n+function removeAdditionOfZero(node) {\n+  if (node.op !== \"+\") {\n+    return new NodeStatus(node);\n+  }\n+  const zeroIndex = node.args.findIndex(arg => {\n+    return NodeType.isConstant(arg) && arg.value === \"0\";\n+  });\n+  if (zeroIndex >= 0) {\n+    // remove the 0 node\n+    node.args.splice(zeroIndex, 1);\n+    // if there's only one operand left, there's nothing left to add it to,\n+    // so move it up the tree\n+    if (node.args.length === 1) {\n+      node = node.args[0];\n+    }\n+    return new NodeStatus(node, true, MathChangeTypes.SIMPLIFY_ARITHMETIC);\n+  }\n+  return new NodeStatus(node);\n+}\n+\n // If `node` is a multiplication node with 1 as one of its operands,\n // remove 1 from the operands list. Returns a NodeStatus object.\n function removeMultiplicationByOne(node) {\n-  if (node.op === \"*\") {\n-    const i = node.args.findIndex(\n-      arg => arg.type === 'ConstantNode' && arg.value === \"1\");\n-    if (i >= 0) {\n-      // remove the 1 node\n-      node.args.splice(i, 1);\n-      // if there's only one operand left, move it up the tree\n-      if (node.args.length === 1) {\n-        node = node.args[0];\n-      }\n-      return new NodeStatus(node, true, MathChangeTypes.SIMPLIFY_ARITHMETIC);\n+  if (node.op !== \"*\") {\n+    return new NodeStatus(node);\n+  }\n+  const oneIndex = node.args.findIndex(arg => {\n+    return NodeType.isConstant(arg) && arg.value === \"1\";\n+  });\n+  if (oneIndex >= 0) {\n+    // remove the 1 node\n+    node.args.splice(oneIndex, 1);\n+    // if there's only one operand left, there's nothing left to multiply it\n+    // to, so move it up the tree\n+    if (node.args.length === 1) {\n+      node = node.args[0];\n     }\n+    return new NodeStatus(node, true, MathChangeTypes.SIMPLIFY_ARITHMETIC);\n   }\n   return new NodeStatus(node);\n }\n \n+// If `node` is a multiplication node with 0 as one of its operands,\n+// reduce the node to 0. Returns a NodeStatus object.\n+function reduceMultiplicationByZero(node) {\n+  if (node.op !== \"*\") {\n+    return new NodeStatus(node);\n+  }\n+  const zeroIndex = node.args.findIndex(arg => {\n+    return NodeType.isConstant(arg) && arg.value === \"0\";\n+  });\n+  if (zeroIndex >= 0) {\n+    // reduce to just the 0 node\n+    node = NodeCreator.constant(0);\n+    return new NodeStatus(node, true, MathChangeTypes.SIMPLIFY_ARITHMETIC);\n+  }\n+  else {\n+    return new NodeStatus(node);\n+  }\n+}\n+\n+// If `node` is a multiplication node with -1 as one of its operands,\n+// and a non constant as the next operand, remove -1 from the operands\n+// list and make the next term have a unary minus.\n+// Returns a NodeStatus object.\n+function removeMultiplicationByNegativeOne(node) {","path":"lib/expression/step-solver/simplifyOperations.js","position":241,"original_position":241,"commit_id":"df1e3e6ab1139b71de3eee821b86fdd1358f699a","original_commit_id":"df1e3e6ab1139b71de3eee821b86fdd1358f699a","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":"okay sweet, I'm comforted by the fact that you find it easy to follow 👍 ","created_at":"2016-09-30T16:16:06Z","updated_at":"2016-09-30T16:16:06Z","html_url":"https://github.com/socraticorg/mathjs/pull/12#discussion_r81370084","pull_request_url":"https://api.github.com/repos/socraticorg/mathjs/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/socraticorg/mathjs/pulls/comments/81370084"},"html":{"href":"https://github.com/socraticorg/mathjs/pull/12#discussion_r81370084"},"pull_request":{"href":"https://api.github.com/repos/socraticorg/mathjs/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/socraticorg/mathjs/pulls/12","id":86962419,"html_url":"https://github.com/socraticorg/mathjs/pull/12","diff_url":"https://github.com/socraticorg/mathjs/pull/12.diff","patch_url":"https://github.com/socraticorg/mathjs/pull/12.patch","issue_url":"https://api.github.com/repos/socraticorg/mathjs/issues/12","number":12,"state":"open","locked":false,"title":"Ek subtraction","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-09-27T16:13:53Z","updated_at":"2016-09-30T16:16:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"55dfed2667ecbd7a824260425862f864dfa36cc2","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/12/commits","review_comments_url":"https://api.github.com/repos/socraticorg/mathjs/pulls/12/comments","review_comment_url":"https://api.github.com/repos/socraticorg/mathjs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/socraticorg/mathjs/issues/12/comments","statuses_url":"https://api.github.com/repos/socraticorg/mathjs/statuses/df1e3e6ab1139b71de3eee821b86fdd1358f699a","head":{"label":"socraticorg:ek-subtraction","ref":"ek-subtraction","sha":"df1e3e6ab1139b71de3eee821b86fdd1358f699a","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-29T19:30:06Z","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":32337,"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":"8ed2cd0d6ba4868fd0bb5059a4063b4f1d8cc8b3","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-29T19:30:06Z","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":32337,"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/12"},"html":{"href":"https://github.com/socraticorg/mathjs/pull/12"},"issue":{"href":"https://api.github.com/repos/socraticorg/mathjs/issues/12"},"comments":{"href":"https://api.github.com/repos/socraticorg/mathjs/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/socraticorg/mathjs/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/socraticorg/mathjs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/socraticorg/mathjs/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/socraticorg/mathjs/statuses/df1e3e6ab1139b71de3eee821b86fdd1358f699a"}}}}
{"actor":{"display_login":"evykassirer"}}