static/src/transform.js
/**
 * Transform an array of operations against another list
 * of operations. Return the operations each side must apply
 * to reach the same state space.
 * @param {Array} op_lefts - The first array of operations
 * @param {Array} op_rights - The second array of operations
 * @returns {Array} An array with two elements | 0 - the operations the left must apply, 1 - the operations the right must apply
 */
Transform an array of operations against another list
of operations. Return the operations each side must apply
to reach the same state space.
@param {Array} op_lefts - The first array of operations
@param {Array} op_rights - The second array of operations
@returns {Array} An array with two elements | 0 - the operations the left must apply, 1 - the operations the right must apply
Transform an array of operations against another list of operations . Return the operations each side must apply to reach the same state space . @param { Array } op_lefts - The first array of operations @param { Array } op_rights - The second array of operations @returns { Array } An array with two elements | 0 - the operations the left must apply 1 - the operations the right must apply
function xform_multiple(op_lefts, op_rights){
    var to_apply_left = [];
    var to_apply_right = [];
    var current_rights = op_rights;
    for (var i = 0; i < op_lefts.length; i++){
        var next_rights = [];
        let opl = op_lefts[i];
        var current_left = opl;
        for (var j = 0; j < current_rights.length; j++){
            let current_right = current_rights[j];
            next_rights.push(xform(current_right, current_left));
            current_left = xform(current_left, current_right);
        }
        to_apply_right.push(current_left);
        current_rights = next_rights;
    }
    to_apply_left = current_rights;
    return [to_apply_left, to_apply_right]
}
function xform_multiple ( op_lefts , op_rights ) { var to_apply_left = [ ] ; var to_apply_right = [ ] ; var current_rights = op_rights ; for ( var i = 0 ; i < op_lefts . length ; i ++ ) { var next_rights = [ ] ; let opl = op_lefts [ i ] ; var current_left = opl ; for ( var j = 0 ; j < current_rights . length ; j ++ ) { let current_right = current_rights [ j ] ; next_rights . push ( xform ( current_right , current_left ) ) ; current_left = xform ( current_left , current_right ) ; } to_apply_right . push ( current_left ) ; current_rights = next_rights ; } to_apply_left = current_rights ; return [ to_apply_left , to_apply_right ] }
Transform an array of operations against another list
 of operations.
Transform an array of operations against another list of operations .
/*See transform.py for documentation. This is a straight
    translation of python function xform_multiple.
    */