comb4=: 13 :'|.I.(x=+/"1#:i.2^y)##:i.   2^y'
   2 comb4 4
0 1
0 2
0 3
1 2
1 3
2 3
   I.2 comb4 4
1 0 0 0 0
1 1 0 0 0
1 1 1 0 0
0 1 1 0 0
0 1 1 1 0
0 0 1 1 1
   bitcomb=: 13 :'(x=+/"1 #:i.2^y)#"2#:i.2^y' 
   2 bitcomb 4
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 0
   I.2 bitcomb 4
2 3
1 3
1 2
0 3
0 2
0 1
   I.|.2 bitcomb 4
0 1
0 2
0 3
1 2
1 3
2 3
   (2 comb4 4)-:|.I.2 bitcomb 4 
1
   (2 comb4 4)-:(|.I.2 bitcomb 4)
1
   1
1
   

Linda


-----Original Message-----
From: Programming [mailto:[email protected]] On Behalf 
Of Raul Miller
Sent: Tuesday, November 14, 2017 2:08 AM
To: Programming forum <[email protected]>
Subject: Re: [Jprogramming] K-sets - bitmap representation of sets. WAS: 
Partitions

Well... it could not really be a bitmap for this design unless you limited it 
to two partitions.

That said, if I remember right, Erling Hellenäs was generating a similar data 
structure (to be the left argument to </. ) in the various parRuskey 
implementations.

Thanks,

--
Raul


On Tue, Nov 14, 2017 at 1:37 AM, 'Skip Cave' via Programming
<[email protected]> wrote:
> This thread has been an interesting exploration of the many ways to
> implement
> "all combinations of y unique items, x items at a time". I like the idea
> that these
> combination verbs produce a bitmap that can be used to select from a list
> of
> unique items to produce the final combinations.
>
> Does it make sense to use this same technique to generate a partition verb
> which produces a bitmap, which can then be used to partition a list of
> unique items
> showing "all ways to partition y objects into x partitions"?
> Would the combination verbs developed previously help simplify the
> partition verb?
>
> Partition verb rules:
> 1. The par verb is a dyadic verb: x par y where x is the number of
> partitions (boxes)
> & y is the number of unique items to be partitioned (boxed).
>
> 2. The par verb should generate all the ways that y items can be
> partitioned into
> x partitions (containers). Each row in the output will show a different
> allocation
> of the y items.
>
> 3. The partition verb should produce a partitioned bitmap which can be used
> to
> select items from the list y, and place them in the appropriate partitions.
>
> 4. Every partition must have at least one item in it. (no empty partitions)
>
> 5. Every item can only appear once in each partition trial (row).
>
> 6. Re-ordering the items in a single partition does not create a new unique
> partition.
>
> 5. Re-ordering partitions where the same items are still in each partition,
> is not a new
> partition trial.
>
> The result of x par y should be a bitmap such that (x par y) f list will
> show
> all the possible ways to partition y items in x partitions
>
>     2 par 3
>
> ┌─────┬─────┐
>
> │1 1 0 │0 0 1 │
>
> ├─────┼─────┤
>
> │1 0 1 │0 1 0 │
>
> ├─────┼─────┤
>
> │0 1 1 │1 0 0 │
>
> └─────┴─────┘
>
>
> NB. now what is 'f':
>
>
>    (2 par 3) f 'abc'
>
> ┌──┬─┐
>
> │ab│c│
>
> ├──┼─┤
>
> │ac│b│
>
> ├──┼─┤
>
> │bc│a│
>
> └──┴─┘
>
>
> Skip
>
> Skip Cave
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to