One of my experiments was very short, and tantalisingly close to correct: ≠\V
Unfortunately, it's not quite right. Does anyone have an idea how to coerce that one into being right? Regards, Elias On 20 March 2014 16:10, <[email protected]> wrote: > Elias Mårtenson <[email protected]> wrote: > > Assume I have a binary sequence. Say, something like this: > > > > 0 0 1 1 0 0 1 1 1 1 1 0 0 0 1 0 1 0 1 1 0 1 1 1 > > > > Here, we can see a few sequences of consecutive ones. I want to zero out > > every second in each sequence. I.e, I'd like to get the following result: > > > > 0 0 1 0 0 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 0 1 0 1 > > Not sure if it is short enough, but this seems to work; > however I suggest you check it carefully: > V×2|+\1⌈(⍳⍴V)×2|⊤\2+V > > > V ← 0 0 1 1 0 0 1 1 1 1 1 0 0 0 1 0 1 0 1 1 0 1 1 1 > V×2|+\1⌈(⍳⍴V)×2|⊤\2+V > 0 0 1 0 0 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 0 1 0 1 > > > Regards, > > -- > Thomas Baruchel >
