code: function partitionToRule(selection) {
    const roles = [];
    const { dividers, variable } = selection.partition;
    const terms = dividers.map((divider, idx, array) => {
      if (idx === 0) {
        return {
          type: '3L',
          terms: [variable, divider.closeToLeft ? '<' : '<=', divider.value],
        };
      }
      return {
        type: '5C',
        terms: [
          array[idx - 1].value,
          array[idx - 1].closeToLeft ? '<' : '<=',
          variable,
          divider.closeToLeft ? '<' : '<=',
          divider.value,
        ],
      };
    });
    const lastDivider = dividers.slice(-1);
    terms.push({
      type: '3R',
      terms: [lastDivider.value, lastDivider.closeToLeft ? '<' : '<=', variable],
    });
  
    // Fill roles with partition number
    while (roles.length < terms.length) {
      roles.push({ partition: roles.length });
    }
  
    return rule('multi', terms, roles);
  }
docs: ----------