([60, 21, -18, -57, -95, -67, -29, 8, 45, 82] as [Double])
.consecutivePairs
.filter { $0.sign != $1.sign }
public extension Sequence {
/// Each element of the sequence, paired with the element after.
var consecutivePairs: Zip2Sequence<Self, DropFirstSequence<Self>> {
zip(self, dropFirst())
}
}
solved Retrieve numbers before/after sign change in [Double]