Last clean up on this one I promise.

   f=:  (/: #each) @: /:~ @: (#:@i.@(2^#) <@#"1 ]) 
   f 1 6 6 8
┌┬─┬─┬─┬─┬───┬───┬───┬───┬───┬───┬─────┬─────┬─────┬─────┬───────┐
││1│6│6│8│1 6│1 6│1 8│6 6│6 8│6 8│1 6 6│1 6 8│1 6 8│6 6 8│1 6 6 8│
└┴─┴─┴─┴─┴───┴───┴───┴───┴───┴───┴─────┴─────┴─────┴─────┴───────┘

Cleaning off the empty set and the universal set

   }. }: f 1 6 6 8
┌─┬─┬─┬─┬───┬───┬───┬───┬───┬───┬─────┬─────┬─────┬─────┐
│1│6│6│8│1 6│1 6│1 8│6 6│6 8│6 8│1 6 6│1 6 8│1 6 8│6 6 8│
└─┴─┴─┴─┴───┴───┴───┴───┴───┴───┴─────┴─────┴─────┴─────┘

Products of each set
  */ each  }. }: f 1 6 6 8
┌─┬─┬─┬─┬─┬─┬─┬──┬──┬──┬──┬──┬──┬───┐
│1│6│6│8│6│6│8│36│48│48│36│48│48│288│
└─┴─┴─┴─┴─┴─┴─┴──┴──┴──┴──┴──┴──┴───┘

Cheers, bob


> On May 7, 2016, at 10:59 PM, Skip Cave <[email protected]> wrote:
> 
> psm =. ((] # 2:) #: >:@i.@(_2: + 2: ^ ])) #L:0"1 <@i.

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

Reply via email to