Timeline for Counting 'False' values at the ends of a list
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 11, 2014 at 13:34 | comment | added | Mr.Wizard |
Not SplitBy , Split . :-) I would write: Length /@ Split[t][[{1, -1}]] , Also, note that this method will only work if one is certain that the list begins and ends with False ; it cannot handle a "zero count" case.
|
|
Jan 11, 2014 at 13:32 | history | edited | Nasser | CC BY-SA 3.0 |
No need for the False, it will work without it as is
|
Jan 11, 2014 at 13:28 | comment | added | Mr.Wizard |
I don't understand what you intend with SplitBy[t, False] . I believe it is equivalent to Split[t] here.
|
|
Jan 11, 2014 at 13:16 | comment | added | bobthechemist |
I get about a 40% reduction in computation time with SplitBy relative to LengthWhile .
|
|
Jan 11, 2014 at 11:48 | history | answered | Nasser | CC BY-SA 3.0 |