I've often wished for variants on /. -- I'd like its verb to see its right argument. I'd like to be able to group on a variety of keys (emulating 2 verb\ ] instead of _2 verb\ ]), etc.
All these are possible currently, of course, but they require a bit more thought and effort (and time). And, once I've got a verb, I wonder if it can be done more simply. For example, let's say d is some data to be grouped and c is a boxed list of categories each data element belongs to: c=:[EMAIL PROTECTED]:&.>d=:9+i.9 I want to group each element in d according to these categories, and I want each category to remain associated with each group (let's pretend like I'm dealing with a general case where you cannot assume anything about which members of the potential domain are in d): |:/:~ c >@(~.@;@[ ;&.> ;@[ </. #@>@[ # ]) d +-----------+-------+-----+--+--+--+--+ |2 |3 |5 |7 |11|13|17| +-----------+-------+-----+--+--+--+--+ |10 12 14 16|9 12 15|10 15|14|11|13|17| +-----------+-------+-----+--+--+--+--+ (The sort and transpose are for conceptualization purposes, representing some arbitrary later operation I might want to perform on the grouped collection.) Can anyone think of a more concise way of expressing this analogy to /. than group=:1 :'u&>/"1@|:@>@(~.@;@[ ,&<&.> ;@[ </. #@>@[ # ])' c ;group d ? Thanks, -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
