Another great idea. Thanks again.
On Thu, 7 Jan 2021 at 12:38, Raul Miller <[email protected]> wrote: > > That's better than mine. > > (And, I should mention, I used the phrase "undefined / unreferenced / > misreferenced symbols" because i did not know how to classify the > stuff which I did not understand.) > > That said, there's an available improvement here, so that an error is > not thrown on an empty argument. There's a variety of ways of > expressing it, but basically you need to add the fill element before > trimming the list. For example: > > <&0 {{<;.2~ (~: }.@,&_)@:u}} _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:31 AM 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 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
