Thanks to all.
besides it helps to memorize with a nice name.
Roger Hui wrote:
Fails on the empty list. Likewise Oleg's solution.
(> 0 , }:) i.0
|length error
| (>0,}:)i.0
({. , 2 </\ ]) i.0
0
----- Original Message -----
From: Chris Burke <[EMAIL PROTECTED]>
Date: Tuesday, March 4, 2008 21:47
Subject: Re: [Jprogramming] leading edge of a boolean array
To: Programming forum <[email protected]>
Oleg Kobchenko wrote:
({. , 2 </\ ]) 0 1 0 1 1 0 1 1 1 0 1 0
0 1 0 1 0 0 1 0 0 0 1 0
--- bill lam <[EMAIL PROTECTED]> wrote:
how to find the leading edge of a boolean array,
eg. for this array
0 1 0 1 1 0 1 1 1 0 1 0
Also:
(> 0 , }:) 0 1 0 1 1 0 1 1 1 0 1 0
0 1 0 1 0 0 1 0 0 0 1 0
(defined as firstones in script parts).
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm