You've got too many undefined / unreferenced / misreferenced symbols
here for me to be completely sure some of the details of what you are
saying.

That said, I think you might be looking for something like this:

   F=: {{</.~ +/\@(1,2~:/\])@:u}}
   <&0 F _1 _2 0 1 2 _1 4 5 _6
+-----+-----+--+---+--+
|_1 _2|0 1 2|_1|4 5|_6|
+-----+-----+--+---+--+

Thanks,

-- 
Raul

On Thu, Jan 7, 2021 at 4:12 AM Justin Paston-Cooper
<[email protected]> wrote:
>
> I am sure this has been asked and formulated somewhere else. I don't
> know what the name of it is.
>
> Let G be a set of groups. Given a list `l =: l_1 ... l_2` and a
> property `p` such that `p l_i` is in G, I would like a function `f`
> which partitions `l` into the successive maximally contiguous runs
> `r_1 ... r_k` such that for each `i`, `r_i` is a substring of `l`,
> there exists one `g` in G such that all `p r_ij = g` and the
> concatenation of `r_1 ... r_k` is equal to the original `l`.
>
> Examples:
>
> l = _1 _2 0 1 2 _1 4 5 _6`
> p = <&0
>
> f l = _1 _2 ; 0 1 2 ; _1 ; 4 5 ; _6
>
> ;. gets close, but one would need to specify where groups end possibly
> by comparing successive pairs of applications of `p`. Those positions
> would somehow need to be indicated as frets.
>
> /. gets close, but concatenates separate runs within the same group.
>
> Is this trivial, or should I write my own code for this?
> ----------------------------------------------------------------------
> 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