[Jprogramming] Modified assignment

Graham Parkhouse graham.parkhouse at ntlworld.com
Wed Oct 8 04:08:57 HKT 2008


Dear J Forum

Dyalog APL allows f <- where f is a dyadic function, as in

     a <- 10 rho 0
     a[2 2 5 6 2] + <- 3 4 5 6 7
     a
0 0 14 0 0 5 6 0 0 0

How do I do this in J?

Amend won't do it - I didn't expect it to.

   a=: 10$0
   a=: a+(3 4 5 6 7)(2 2 5 6 2)}a
   a
0 0 7 0 0 5 6 0 0 0

The difference arises when indices are repeated, the index 2 in the example.
3 4 5 6 7 is a list of contributions and 2 2 5 6 2 is a list of
destinations.

Any suggestions will be appreciated.

Regards

Graham Parkhouse



More information about the Programming mailing list