Here is a cousin to my problem, based on your solution:
g=: 13 :'y(<@{."0)1'
g i
┌─────┬───┬─────────┬───────────────┬─────────┬─────┐
│1 0 0│1 0│1 0 0 0 0│1 0 0 0 0 0 0 0│1 0 0 0 0│1 0 0│
└─────┴───┴─────────┴───────────────┴─────────┴─────┘
5!:4 <'g'
┌─ 1
│ ┌─ <
──┤ ┌─ @ ─┴─ {.
├─ ~ ─── " ─┴─ 0
└─ ]
h=: 13 :'y([:<{."0)1'
h i
┌───────────────┐
│1 0 0 0 0 0 0 0│
│1 0 0 0 0 0 0 0│
│1 0 0 0 0 0 0 0│
│1 0 0 0 0 0 0 0│
│1 0 0 0 0 0 0 0│
│1 0 0 0 0 0 0 0│
└───────────────┘
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Ric Sherlock
Sent: Wednesday, October 10, 2012 4:09 AM
To: [email protected]
Subject: Re: [Jprogramming] Partitioning a string into unequal-length parts
Hi Linda,
If I understand correctly you're trying to come up with a different but
equivalent way of formulating
c=:i{.&.>1
Here is one
d=: i (<@{."0 ) 1
c-:d
1
Ric
On Oct 10, 2012 7:41 PM, "Linda Alvord" <[email protected]> wrote:
> I hope this is easier to read.
>
> az=:'abcdefghijklmnopqrstuvwxyz'
> i=:3 2 5 8 5 3
> (;i{.&.>1) <;.1 az
> ┌───┬──┬─────┬────────┬─────┬───┐
> │abc│de│fghij│klmnopqr│stuvw│xyz│
> └───┴──┴─────┴────────┴─────┴───┘
>
> ]c=:i{.&.>1
> d=:<(>i){.>1
> c-:d
> 0
> e=:<(>"0 i){.>1
> c-:e
> 0
> f=:<"0(>"0){.>1
> c-:f
> 0
> g=:<"0(>"0){.(>"0) 1
> c-:g
> 0
>
> Vocabulary: x u&.v y ↔ vi (v x) u except that the verb obverse to v is
> applied to the result for each cell.
>
> How do you apply the definition in this case?
>
> Linda
>
> -----Original Message-----
> From: [email protected] [mailto:programming-
> [email protected]] On Behalf Of Roger Hui
> Sent: Wednesday, October 10, 2012 12:36 AM
> To: [email protected]
> Subject: Re: [Jprogramming] Partitioning a string into unequal-length
> parts
>
> The design of *cut* comes from section K of *Rationalized
> APL*<http://www.jsoftware.com/papers/RationalizedAPL.htm>,
> written by Ken Iverson in 1983 at the height of his powers. In the
> original publication the description of *cut* was split with half on
> one page and the other half on the obverse. In order to understand
> it, I finally had to photocopy the two halves and paste them together
> onto a single page, and studied the single page.
>
>
>
> On Tue, Oct 9, 2012 at 8:43 PM, Ian Clark <[email protected]> wrote:
>
> > Thank you everybody. That's turned the hay over in my mind.
> >
> > I really ought to know my standard J manuals better...
> > The very first example of Phr: 5B. Partition
> > http://jsoftware.com/help/phrases/partition.htm
> > -essentially answers my question.
> > Left argument to Cut (;.) -- a blind spot for me.
> >
> > On Tue, Oct 9, 2012 at 3:32 PM, 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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm