This is a frequent request at this forum. I use
,/"naughty_rank big_rank_data
I'll also point out that it's rather important to know the frame and
items for the operation. This way you might be able to choose
operations that directly produce the desired shape. I've included a few
examples.
9!:7'+++++++++|-'
(; $) a=: 2 3 1 $ 80 }. a.
+-+-----+
|P|2 3 1|
|Q| |
|R| |
| | |
|S| |
|T| |
|U| |
+-+-----+
(; $) ,/"1 a
+---+---+
|PQR|2 3|
|STU| |
+---+---+
rank=: [: $ $
rank a
3
NB. prefix produces consistent rank
NB. 'P' could have had rank 0
(; rank) \ 'PQRS'
+----+-+
|P |1|
+----+-+
|PQ |1|
+----+-+
|PQR |1|
+----+-+
|PQRS|1|
+----+-+
head=: {. : [:
take=: [: : {.
from=: {
(; rank) 1 take a
+-+-+
|P|3|
|Q| |
|R| |
+-+-+
(; rank) 0 from a
+-+-+
|P|2|
|Q| |
|R| |
+-+-+
(; rank) head a
+-+-+
|P|2|
|Q| |
|R| |
+-+-+
On Fri, 2011-07-22 at 07:47 +0800, [email protected]
wrote:
> Date: Fri, 22 Jul 2011 00:46:21 +0100
> From: mijj <[email protected]>
> Subject: [Jprogramming] easy way to remove a trailing [1] from a
> shape?
> To: Programming forum <[email protected]>
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> i'd like to be able to remove a trailing [1] from a Data's shape.
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm