Re: Mathematica and Lisp
- To: mathgroup at smc.vnet.net
- Subject: [mg130053] Re: Mathematica and Lisp
- From: "Nasser M. Abbasi" <nma at 12000.org>
- Date: Thu, 7 Mar 2013 03:58:57 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
- References: <kh779n$pvu$1@smc.vnet.net>
- Reply-to: nma at 12000.org
On 3/6/2013 4:54 AM, Bill Rowe wrote: > But > if I had a variable mylist set to {x,y,z}, then I would either > code the sum as Plus@@myList or Total@myList or Total[myList] > > Similarly if I myMatrix were a n x m array and I wanted to > compute the sum of each row, I might well code this as Plus@@@myMatrix. > Nice examples. I do not use @@@ myself. But interesting that the use of Total in the matrix case does not follow the example from the list case: ------- OK ----------------- myList = {1, 2, 3}; Plus @@ myList Total @ myList ----------------------- So, I thought it should then work the same for matrix, I should remove one "@" for Total compared to the Plus case ------Not OK ------------------- myList = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}} Plus @@@ myList Total @@ myList ------------------------------ I need to look more into this to see why it did not follow the same example for list. --Nasser