I see that I thanked Don for your edited idea. Thanks. I will try to
not spam too many more thanks.

On Thu, 7 Jan 2021 at 12:31, xash <xash@λ.land> wrote:
>
> l =: _1 _2 0 1 2 _1 4 5 _6
> p =: <&0
> (<;.1~ (~:_,}:)@p) l
> ┌─────┬─────┬──┬───┬──┐
> │_1 _2│0 1 2│_1│4 5│_6│
> └─────┴─────┴──┴───┴──┘
>
>
> On Thu Jan 7, 2021 at 10:12 AM CET, Justin Paston-Cooper 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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to