dist/script/prelude/array.js
function groupBy(f, xs) {
    const groups = [];
    for (const x of xs) {
        if (groups.length !== 0 && f(groups[groups.length - 1][0], x)) {
            groups[groups.length - 1].push(x);
        }
        else {
            groups.push([x]);
        }
    }
    return groups;
}
function groupBy(f, xs) {
    const groups = [];
    for (const x of xs) {
        if (groups.length !== 0 && f(groups[groups.length - 1][0], x)) {
            groups[groups.length - 1].push(x);
        }
        else {
            groups.push([x]);
        }
    }
    return groups;
}
function groupBy ( f , xs ) { const groups = [ ] ; for ( const x of xs ) { if ( groups . length !== 0 && f ( groups [ groups . length - 1 ] [ 0 ] , x ) ) { groups [ groups . length - 1 ] . push ( x ) ; } else { groups . push ( [ x ] ) ; } } return groups ; }
Splits an array based on the equivalence relation.
The concatenation of the result is equal to the argument.
Splits an array based on the equivalence relation . The concatenation of the result is equal to the argument .