Some problems
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
ac=: 13 :'((po + cm) ($y)#2){,'' '',.y'
ac 'PNDQ'
PPPPPPPP
NNNN NNNN
DD DD DD DD
Q Q Q Q Q Q Q Q
Hope this works.
-----Original Message-----
From: Programming <[email protected]> On Behalf Of
lindaalvord
Sent: Saturday, December 15, 2018 8:51 PM
To: [email protected]
Subject: [Jprogramming] (no subject)
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
https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=02%7C01%7C%7Ce30db27a8a2a42f6812d08d662f8edf4%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636805218627173404&sdata=IaqgsTuLJ4KWsrxrBIpbWvwq76CVThMOEcSk%2Fri4WDo%3D&reserved=0
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm