(Javascript) itertools.groupBy, e.g. [0,0,1,1,0] -> [[0,0],[1,1],[0]]
JavaScript, 47 points (53 tiebreaker)

Array.prototype.group = function(f){
    const r = []
    let k = r
    for(const i of this)
        k !== (k = f ? f(i) : i) ? r.push(a = [i]) : a.push(i)
    return r
}



Body: +52
Identity comparison: -5
Full-length built-ins: +6


Try it:



Array.prototype.group = function(f){
    const r = []
    const k = r
    for(const i of this)
        k!==(k=f?f(i):i)?r.push(a=[i]):a.push(i)
    return r
}

console.log(
    ['a','c','E','G','n'].group(x =&gt; x==x.toUpperCase()),
    [1,1,'1'].group(x=&gt;x),
    [3,1,'1',10,5,5].group(x=&gt;x+2),
    [{a:1,b:2,c:3}, {b:2,a:1,c:0}, {c:5}].group(x =&gt; JSON.stringify([x.a, x.b])),
    [].group(x=&gt;x)
)






JavaScript, 48 points (56 tiebreaker)

More traditional code golf-y solution.

Array.prototype.group = function(f,r=[],k=r){
    this.map(i=&gt;k!==(k=f?f(i):i)?r.push(a=[i]):a.push(i))
    return r
}



Signature: +9
Body: +44
Identity comparison: -5
Full-length built-ins: +8


Try it:



Array.prototype.group = function(f,r=[],k=r){
    this.map(i=&gt;k!==(k=f?f(i):i)?r.push(a=[i]):a.push(i))
    return r
}

console.log(
    ['a','c','E','G','n'].group(x =&gt; x==x.toUpperCase()),
    [1,1,'1'].group(x=&gt;x),
    [3,1,'1',10,5,5].group(x=&gt;x+2),
    [{a:1,b:2,c:3}, {b:2,a:1,c:0}, {c:5}].group(x =&gt; JSON.stringify([x.a, x.b])),
    [].group(x=&gt;x)
)