Suppose I have a list filled with zeroes
val a = List(0,0,0,0,2,4,0,6,0,7)
I want to slice away the zeroes preceding the first non-zero element and also return the index where the 1st non-zero element is present. Foe the above case I want an output:
output = List(2,4,0,6,0,7)
idx = 4
How do I do it?