Japt, 88 6 bytes
-2 bytes thanks to @ETHproductions
ò¦ ®ì2Ãxxì2
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ì2
Map each partition (®
) to itself parsed as an array of base-2
digits (ì
): [7, -15, 3]
Ãxx
End mapping (Ã
) andGet the sum (x
) of the resulting array: -5