I showed you how to replace &.: below. Same way you replaced those &s, only you have to "undo" (mnemonic: under -> undo) v at the end.
SEE5A =: ([: (- (+/ % #)) [) (([: +/ *) % [: %: (([: +/ [: *: [) * [: +/ [: *: ])) [: (- (+/ % #)) ] [There's a lot of unnecessary clutter in here, but I just made the minimal edits to remove the &.: ] -Dan On Feb 20, 2013, at 10:34 PM, "Linda Alvord" <[email protected]> wrote: > So far I removed all but &.: > > gnp1955 SEE4A trade1955 > 0.925343 > > SEE4A > ([: (- (+/ % #)) [) (([: +/ *) % (([: +/ [) * [: +/ ])&.:*:"_) [: (- (+/ % > #)) ] > > You did guess what I would be doing! > > Linda > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Dan Bron > Sent: Wednesday, February 20, 2013 11:38 AM > To: [email protected] > Subject: Re: [Jprogramming] applying >1 gerunds to a set of items > > I wrote: >> corr =: (+/@:* % *&(+/)&.:*:)&(- +/%#) > > Linda asked for: >> some sample data for corr with your expected result > > I'll just short-circuit this discussion and rephrase corr in Simplistic J > for you. > > avg =: +/ % # > sumSqrs =: 13 : '+/ *: y' > simplisticCorr =: 13 : '(x - avg x) ( ([: +/ *) % [: %: ([: sumSqrs [) > * [: sumSqrs ]) (y - avg y)' > simplisticCorrSpelledOut =: simplisticCorr f. > > simplisticCorr > ([ - [: avg [) (([: +/ *) % [: %: ([: sumSqrs [) * [: sumSqrs ]) ] - [: avg > ] > > simplisticCorrSpelledOut > ([ - [: (+/ % #) [) (([: +/ *) % [: %: ([: ([: +/ *:) [) * [: ([: +/ *:) ]) > ] - [: (+/ % #) ] > > Of course, defining it this way defeats the entire purpose for which I > introduced corr (elegance, simplicity, symmetry, brevity) but I know you > have other purposes (avoiding conjunctions at all costs). > > So if you want to play with it for these purposes, any standard textbook > example of calculating the correlation coefficient will do: > > gnp1955 =: 91 51 58 359 134 70 129 515 70 707 468 749 998 > 2334 > trade1955 =: 2729 407 349 1169 923 2689 1601 415 83 5395 1852 6530 18677 > 26836 > > gnp1955 corr trade1955 NB. GNP/capita highly correlated with trade in > 1955 > 0.925343 > gnp1955 simplisticCorr trade1955 > 0.925343 > gnp1955 simplisticCorrSpelledOut trade1955 > 0.925343 > > However, for those are interested in the verb's form, rather than its > function, and want to know why I introduced it as a beautiful example of J, > some explanations can be in the original thread: > > http://www.jsoftware.com/pipermail/programming/2007-June/007179.html > > [I should have noted yesterday that Oleg Kobchenko was the original author > of corr (which I was somewhat disappointed to discover when I independently > developed it some years later....)] > > -Dan > > PS: Because I know you want to see it: > > 5!:4<'simplisticCorr' > +- [ > +- - > +-+ +- [: > | +---+- avg > | +- [ > | > | +- [: > | +---+- / --- + > | | +- * > | +- % > +-+ +- [: > | | +- %: > --+ | | +- [: > | +---+ +---+- sumSqrs > | | | +- [ > | +-----+- * > | | +- [: > | +---+- sumSqrs > | +- ] > | +- ] > | +- - > +-+ +- [: > +---+- avg > +- ] > > 5!:4<'simplisticCorrSpelledOut' > +- [ > +- - > +-+ +- [: > | | | +- / --- + > | +---+-----+- % > | | +- # > | +- [ > | > | +- [: > | +---+- / --- + > | | +- * > | +- % > | | +- [: > +-+ +- %: > | | | +- [: > --+ | | | +- [: > | +---+ +-----+----+- / --- + > | | | | +- *: > | | | +- [ > | +-----+- * > | | +- [: > | | | +- [: > | +-----+----+- / --- + > | | +- *: > | +- ] > | +- ] > | +- - > +-+ +- [: > | | +- / --- + > +---+-----+- % > | +- # > +- ] > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
