I wrote:
> Statistical correlation
> (+/@:* % *&(+/)&.:*:)&(- +/%#)
> Rephrase corr in Simplistic J
> ([ - [: (+/ % #) [) (([: +/ *) % [: %: ([: ([: +/ *:) [) * [: ([: +/ *:)
]) ] - [: (+/ % #) ]
I'll also take this opportunity to emphasize the differences between these
two (equivalent) verbs, which result _directly_ from the language features I
mentioned in my original message:
> It's got specimens of all the major compositions in J: fork, hook, atop,
compose, and under.
You can judge for yourself the consequences of avoiding these, and the
wisdom of making that a blanket rule.
Still, you might be willing to pay a "complexity tax" to avoid explicit
function composition in J. That's ok, but even paying that cost won't make
you whole: you're still missing out on some of the major advantages of
working in the language.
For example, later in the thread I mentioned, Oleg was able to refine his
definition and produce an even more compact version [1]:
+/@:*&(% +/&.:*:)&(- +/%#)
Again, he achieved this result through judicious application of
conjunctions. Now, I still prefer the original because of its structural
symmetries, but this version also has its merits: it makes it clear that
correlation is simply the linear combination of the series, after some
normalization/standardization. We're getting insight into the _math_ simply
by trying different ways of expressing ourselves!
I think June Kim summed it up best [2]:
> While I try to translate a mathematical expression into
> a J expression, I often discover hidden patterns in the
> expression with great joy.
>
> It sometimes leads me to a path to new insights.
-Dan
[1] http://www.jsoftware.com/pipermail/programming/2007-June/007209.html
[2] http://www.jsoftware.com/pipermail/programming/2007-June/007181.html
PS: In case my point about +/@:*&(% +/&.:*:)&(- +/%#) wasn't clear:
sum +/
of @
the_product *
after &
scaling (% +/&.:*:)
after &
standardizing (- +/%#)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm