Re: [Bug-apl] How to zero every other 1 in a sequence

2014-03-21 Thread Juergen Sauermann
Hi, extending Kacper's idea, you could also try: (X/X)←∈(⍴¨X⊂X)⍴¨⊂1 0 It is a bit longer but may be faster because it avoids \. /// Jürgen On 03/20/2014 08:08 PM, Kacper Gutowski wrote: On 2014-03-21 00:23:41, Elias Mårtenson wrote: One of my experiments was very short, and tantalisi

Re: [Bug-apl] How to zero every other 1 in a sequence

2014-03-21 Thread Elias Mårtenson
Wow. That really works. Pretty neat! (it does cause the interpreter to crash if you feed it unexpected (non-boolean) data though, :-) ) Regards, Elias On 21 March 2014 03:08, Kacper Gutowski wrote: > On 2014-03-21 00:23:41, Elias Mårtenson wrote: > > One of my experiments was very short, and

Re: [Bug-apl] How to zero every other 1 in a sequence

2014-03-20 Thread Kacper Gutowski
On 2014-03-21 00:23:41, Elias Mårtenson wrote: > 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? I couldn't come up with anything better, but if you

Re: [Bug-apl] How to zero every other 1 in a sequence

2014-03-20 Thread Elias Mårtenson
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, wrote: > Elias Mårtenson wrote: > > Assume I have a binary sequence. S

Re: [Bug-apl] How to zero every other 1 in a sequence

2014-03-20 Thread baruchel
Elias Mårtenson 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

[Bug-apl] How to zero every other 1 in a sequence

2014-03-19 Thread Elias Mårtenson
I've been struggling with this one for days now, and I really need some advice. 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,