rem =: -@:(=/"1)@:(_2&{."1) <@}."0 1 ]
a =. 61 72 73 73 ,: 2 3 50 49
rem a
+--------+---------+
|61 72 73|2 3 50 49|
+--------+---------+
However...I advise you to avoid the boxing if you can. If
you can use the trailing 0 to indicate where a value has been
deleted, your code will run faster.
Henry Rich
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> Vladimir Lazunin
> Sent: Sunday, March 19, 2006 7:15 PM
> To: [email protected]
> Subject: [Jprogramming] Jagged array
>
> I have a matrix of integers, there are 4 columns and any
> numberof rows. In
> any of the rows two last numbers could be equal. If so, one should be
> removed. I.e., for example, this:
> 61 72 73 73
> 2 3 50 49
> should turn to:
> 61 72 73
> 2 3 50 49
> Or, rather:
> +--------+---------+
> |61 72 73|2 3 50 49|
> +--------+---------+
> I've managed to do that for a single row by defining
> (probably, really
> ugly):
> er_if =: 3 : '(y. -. 3 { y.),(3 { y.)'
> What I need is to get rid of those trailing 0-s when I aply
> it to the entire
> matrix. I plan to use # on it later and I need it to return 3 or 4,
> respectively, not always 4.
>
> ----------------------------------------------------------------------
> For information about J forums see
> http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm