On Mon, Sep 17, 2012 at 11:14 PM, June Kim (김창준) <junea...@gmail.com> wrote:
> It's not so difficult. However, generalizing takecut into allowing 0 as an
> item in x seems complicated. That is,
>
>    3 0 2 2 takecut i.7
> +-----++---+---+
> |0 1 2||3 4|5 6|
> +-----++---+---+
>    0 0 4 3 0 takecut i.7
> +++-------+-----++
> |||0 1 2 3|4 5 6||
> +++-------+-----++
>
> Any ideas for simple solutions?

   takecut=: *@[ #inv ] </.~ +/\@[ I. #\@]
   0 0 3 3 0 2 takecut i. 7
┌┬┬─────┬─────┬┬─┐
│││0 1 2│3 4 5││6│
└┴┴─────┴─────┴┴─┘

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

Reply via email to