Hi, This is very similar to what you’re doing (you have to transpose the result to get exactly what you want):
AC=: ({.~ -@>:@#) {~ #\ *"1 [: #:@i. 2 ^ # |:AC 'PNDQ' PPPPPPPP NNNN NNNN DD DD DD DD Q Q Q Q Q Q Q Q This one is quite cute if you don’t care about the aligning of the columns, but it only works for vectors, and a space / zero must be appended at the end of the vector: (] , (,. ,.))/'PNDQ ' Q D DQ N NQ ND NDQ P PQ PD PDQ PN PNQ PND PNDQ Cheers, Louis > On 16 Dec 2018, at 02:50, lindaalvord <lindaalv...@verizon.net> wrote: > > > In 1984 I wrote a little paperback called “Probility in APL”. I have been > thinking about combination. So I translated three verbs to provide all the > ways ‘PNDQ’ or a penny, nickel, > dime and quarter could be combined. > > Possible outcomes: > po=: 13 :'|:y#:i.*/y' > po 2 2 2 2 > 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 > 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 > 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 > 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 > Correction matrix: (array) > > cm=: 13 :'(*/y)(#"0) 0,}:+/y' > cm 2 2 2 2 > 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 > 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 > 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 > All combinations as chafacters: > > ac=: 13 :'((po + cm) ($y)#2){,'' '',.y' > ac 'PNDQ' > PPPPPPPP > NNNN NNNN > DD DD DD DD > Q Q Q Q Q Q Q Q > Each column is possible combination of the coins. > > I’m interested to know a better way to get this conclusion. > > Linda > > > > Sent from my Verizon, Samsung Galaxy smartphone > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm