On Wed, Oct 29, 2008 at 15:12, Matthew Brand <[EMAIL PROTECTED]> wrote:
> copy forward the number which occurs before
> the first zero in any sequence of zeroes into the positions of those
> zeroes?

   0 (~:(#{~[:<:+/[EMAIL PROTECTED])]) 1 0 2 3 4 5 0 0 0 4 3 2 4
1 1 2 3 4 5 5 5 5 4 3 2 4

The inner diad (#{~[:<:+/[EMAIL PROTECTED]) excepts a zero-one mask as its left
argument and some list of the same length on its right, keeps the
values where the mask is 1, and copies from left where the mask is
zero.

Ambrus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to