I always read/interpret "@" or "@:" as "of the" Took me a while to get this "interpretation" but now I use it all the time when I write J programs:
rms =: %:@(+/%#)@*: NB. square root "of the" mean "of the" squares. On Mon, Nov 18, 2013 at 6:06 PM, Don Kelly <[email protected]> wrote: > You sent an answer to my question before I asked it! Thanks- I suspected > but didn't know that this was it. > > I think that I will stay with the earlier definition: > > rms=:[:%:[:(+/%#)*: > which, while it does have brackets is somewhat more readable for my present > state of understanding. Yours is shorter and I expect it would be faster. > Now all of you have given me enough to digest for now. > Don > > > On 17/11/2013 7:23 AM, Raul Miller wrote: > >> Here's another definition of rms >> >> Rms=: +/@:*: %:@% # >> Rms 1 2 1 2 >> 1.58114 >> >> Explanation: >> >> We do not need to square the numbers in the argument to #, we only >> need to square them in the argument to +/ >> >> We only need the square root on the result of % >> >> Makes sense? >> >> Also, here's a partial explanation for the (+/%#)&.:*: definition of RMS >> >> &.: means "under" much like &. except that the derived verb has >> infinite rank - the verb on the left gets the entire array which >> resulted from the verb on the right, regardless of the rank of the >> verb on the right. In other words, it is equivalent to (+/ % #) &. >> (*:"_) In other words: square the numbers, add them up, divide by >> their sum, then do the inverse of squaring on the result. >> >> Thanks, >> >> > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > -- Piet de Jong -------------------------------------------------- View my current research at http://ssrn.com/author=619154 -------------------------------------------------- ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
