Louis, That's impressive. I did a little
Cosmetics.
acl=: 13 :'|:(] , (,. ,.))/y'
acl 'HQDNP '
PNNDDDDQQQQQQQQHHHHHHHHHHHHHHHH
P PNN PNNDDDD PNNDDDDQQQQQQQQ
P P PNN P PNN PNNDDDD
P P P PNN
P
acl
[: |: (] , (,. ,.))/
Now my challenge is understand how it wors well enough to explain it to others.
Thanks, Linda acl
-----Original Message-----
From: Programming <[email protected]> On Behalf Of Louis
de Forcrand
Sent: Sunday, December 16, 2018 5:09 PM
To: [email protected]
Subject: Re: [Jprogramming] (no subject)
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 <[email protected]> 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
> https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.j
> software.com%2Fforums.htm&data=02%7C01%7C%7C5e5b77214fed4a7ce9d308
> d663a31a0e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C63680594949679
> 4717&sdata=tq4mny21riot%2BKHKegpf0jCe7WIKxNuhmNLeGbTO4dI%3D&re
> served=0
----------------------------------------------------------------------
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%7C5e5b77214fed4a7ce9d308d663a31a0e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636805949496794717&sdata=tq4mny21riot%2BKHKegpf0jCe7WIKxNuhmNLeGbTO4dI%3D&reserved=0
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm