,"2^:(2 < #@$) i.3 3 3 2 NB. where ]`(,"2)@. would fit your first request.
> Also interested in usage of / or folds where the accumulator rank changes over time (especially if it continues to change after the 1st iteration). would not be drawn to this model, but when processing a a list of items that is meant to return 0 or more items of same shape for each item, (example possible future maze moves from a cell), there needs to be a cleanup step to remove extra shapes to return full result to a list of items (boxes is easiest code). But this can also be done with / or fold, by making the function process x as the item, and accumulate into an initial i.0 num shape compatible with the items. vitems =: 1 : ' (u@[ , ])/@:(] , i.@0) '(}:@:) ,.@#~ vitems ,. 1 2 3 1 1 2 2 3 3 3 1 On Monday, July 25, 2022 at 10:51:16 p.m. EDT, Elijah Stone <[email protected]> wrote: Have you ever written code using @., as in u`v @. w, where the ranks of the results of u and v differ from one another (for a given rank of x/y)? If so, can you post a self-contained snippet? (Don't worry about being runnable; I just want to get a general idea of the code patterns.) Further stipulations: - Should not rely on boxing (incidental use of boxes, eg as record types, is ok) - Equivalent use of explicit control structures or u^:p (for predicate noun or verb p) is ok Also interested in usage of / or folds where the accumulator rank changes over time (especially if it continues to change after the 1st iteration). Thanks! -E ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
