On Mon, Feb 14, 2011 at 5:17 PM, Devon McCormick <[email protected]> wrote:
> I was enjoying Chris Burke's 1996 essay on "Elegant Programming" - > http://www.jsoftware.com/papers/elegant.htm - but when I tried some of his > examples, one did not work. The elegant derivation for harmonic mean from > arithmetic mean: > > am=. +/ % # > hm=. am &. % > > When "hm" is used on the argument "2 3 5" as shown in the essay, it returns > the input instead of the answer "2.9032258". A little investigation > uncovered that the definition of harmonic mean in contemporary J should be > > hm=. am &. (%"_) > Or use &.: But, yes, language drift is hard on reference works. -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
