Thank you, David and Raul, for those two solutions.  Using David's 
approach, the verb I was working on is complete.  It lists all subsets of 
an input list, a.k.a. all combinations of all possible lengths between zero and 
totality.
 
cc=: 3 : 0
 ty=. #y
 zz=. <''   NB. same as  <"_1 (0 comb ty)
 for_h. >:i.ty do. zz=. zz , <"_1 h comb ty end.
 zz {&.> <y
)

The verb comb (all combinations) is drawn from the J Dictionary|Control 
Structures|For
http://www.jsoftware.com/help/dictionary/cfor.htm
as usual.

The technique Raul proposed only works with literal and numeric input.  
It's not a good fit here because I want this verb to receive a list of boxes 
and produce results parallel to what it produces with other data-types. (I 
don't yet understand the niceties of why this is so.)

If anybody thinks the for.-loop of this verb (cc) would be neatly replaced by 
some other structure, I'd be interested in hearing about it.

Tracy



      
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to