Japt, 8 bytes
ò¦ ®ì2Ãx
Explanation
Implicit input: [1, 1, 1, -1, -1, -1, -1, 1, 1]
ò¦
Partition input array (ò
) between different (¦
) elements:
[[1, 1, 1], [-1, -1, -1, -1], [1, 1]]
®ì2
Map each partition (®
) to itself parsed as an array of base-2
digits (ì
): [7, -15, 3]
Ãx
End mapping (Ã
) and sum (x
): -5