[Jprogramming] Another Combination Problem
robert therriault
bobtherriault at mac.com
Sun May 8 06:06:35 UTC 2016
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 <skip at caveconsulting.com> wrote:
>
> psm =. ((] # 2:) #: >:@i.@(_2: + 2: ^ ])) #L:0"1 <@i.
More information about the Programming
mailing list