Hi everyone,
I have a function that returns a list with a series of boolean value False followed by a series of boolean value True like this:
{False, False, False, True, True, True, True, True}
The False's always come before the True's, and the number of False's does not have to equal the number of True's. I need to replace the last False in the series—the third one in my example—with True. This works
Flatten[ReplaceAll[
Split[{False, False, False, True, True, True, True,
True}, #1 =!= #2 &], {False, True} -> {True, True}]]
but it seems like there should be a simpler or more elegant way. Any thoughts?
Greg