Pablo Landherr wrote: > Going for educational value rather than terseness, here is an alternative: > > corr=: [EMAIL PROTECTED] NB. correlation is the crossproduct of > standardised values > cprod=: (+/ .*)~ |: NB. crossproduct > standard=: [EMAIL PROTECTED] NB. standardised numbers are 'adjusted' > and 'centered' > adjust=: ] %"1 [: sqroot sqsum NB. adjusted numbers have a variance of > 1 > center=: -"1 avg NB. centered numbers have a mean of 0 > avg=: +/ % # NB. artitmetic mean > sqroot=: %: NB. square root > sqsum=: +/@:*: NB. sum of squared > > corr 1 3 2 4,"(0) 2 4 3 3.5 > 1 0.831522 > 0.831522 1
I've been following this forum for months with fascination, trying to discover how to go forward with J. The forum content alternately inspires and bewilders me. Function level programming is not coming easily to a 62 year old. Terseness is powerful and challenging, but the neatest expression is bewildering if not understood. Understanding code takes time, a lot longer than either the reading or the writing of it, so Pablo's style is what I want to emulate. Thank you, Pablo! Graham Parkhouse ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
