Key (/.) is cool!  For the boolean case, plus-insert-prefix (+/\) is your friend

      b =: 0 0 1 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0
      +/\ b
   0 0 1 1 2 2 2 2 2 3 3 3 3 3 3 3 3 4 4 4 4 4 4 5 5 5
      (+/\b) </. az
   +--+--+-----+--------+------+---+
   |ab|cd|efghi|jklmnopq|rstuvw|xyz|
   +--+--+-----+--------+------+---+

Thanks for making me read that page.[1]

                        ... peter

[1] http://www.jsoftware.com/docs/help701/dictionary/d421.htm

Christoph von Basum wrote:
Number 1 the brute force way: (i#i.#i)</.az

On Tue, Oct 9, 2012 at 4:37 PM, Roger Hui <[email protected]> wrote:

I mean to say <;.2 instead of <;._2 .



On Tue, Oct 9, 2012 at 7:36 AM, Roger Hui <[email protected]>
wrote:

1. (;i{.&.>1) <;.1 az  (various ways of generating left argument; also
use
<;._2 depending on left argument).
2. b <;._2 az




On Tue, Oct 9, 2012 at 7:32 AM, Ian Clark <[email protected]> wrote:

1. Suppose:
   az=: 'abcdefghijklmnopqrstuvwxyz'
   i=: 3 2 5 8 5 3      NB. -(for example)

How best can I partition az into parts pp where (n{pp) has length (n{i)
?
viz.
   pp -:  'abc';'de';'fghij';'klmnopqr';'stuvw';'xyz'

2. Suppose instead of (i) I have a boolean (b) marking where to cut az
...
   b =: 0 0 1 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0
(c/f dyadic {enclose} in APL+)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm


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

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

Reply via email to