> def parsedLines = lines.withIndex().filter{l, i -> i < 1 || lines[i - 1] != 'a'}.collect{parseLine(it)}
In that Apache Groovy sample, you put an `l` as the first parameter to the `filter` but don't use it anywhere, which is not simple for people reading it. The logic instead requires you to refer to the global input `lines`, which is better expressed imperatively.
And btw in Groovy that code would probably only work on ASCII data.
Really is it so difficult to ignore one parameter for people reading that one liner?
I could have used the underscore but honestly when I'm writing from the phone I don't usually care for small things that don't change absolutely nothing.
At least my code doesn't have the bug that skips TWO lines after the a, like the original code, and it actually saves the parsed lines in a new collection rather than throwing them away and doing nothing at all apart from burning cpu.
But for some strange reason you still prefer that obscure bug-ridden and useless imperative code rather than the self explaining and declarative functional version.
Enjoy your imperative bugs :)
And btw in Groovy that code would probably only work on ASCII data.