lib/simplifyExpression/collectAndCombineSearch/index.js
// returns a list of combine steps
returns a list of combine steps
returns a list of combine steps
function combineLikeTerms(node) {
  const steps = [];
  let newNode = node.cloneDeep();
  for (let i = 0; i < node.args.length; i++) {
    let child = node.args[i];
    if (!Node.Type.isParenthesis(child)) {
      continue;
    }
    child = child.content;
    const childStatus = termCollectorFunctions[newNode.op](child);
    if (childStatus.hasChanged()) {
      const status = Node.Status.childChanged(newNode, childStatus, i);
      steps.push(status);
      newNode = Node.Status.resetChangeGroups(status.newNode);
    }
  }
  return steps;
}
function combineLikeTerms ( node ) { const steps = [ ] ; let newNode = node . cloneDeep ( ) ; for ( let i = 0 ; i < node . args . length ; i ++ ) { let child = node . args [ i ] ; if ( ! Node . Type . isParenthesis ( child ) ) { continue ; } child = child . content ; const childStatus = termCollectorFunctions [ newNode . op ] ( child ) ; if ( childStatus . hasChanged ( ) ) { const status = Node . Status . childChanged ( newNode , childStatus , i ) ; steps . push ( status ) ; newNode = Node . Status . resetChangeGroups ( status . newNode ) ; } } return steps ; }
returns a list of combine steps
returns a list of combine steps
// All groups of terms will be surrounded by parenthesis