I agree that it would be nice to make sure that working code for such papers was available. Perhaps a footnote could indicate the original code (or just an inline aside in a different colour?)
Alternative defn for hm: hm=: am &.: % On Tue, Feb 15, 2011 at 11:17 AM, 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 &. (%"_) > > It would be nice to have these good examples that work with current J though > it would lose some historical perspective. Would it be possible to update > this essay to include the currently working code, perhaps with a footnote > indicating the historical evolution of the language? > > Regards, > > Devon > > -- > Devon McCormick, CFA > ^me^ at acm. > org is my > preferred e-mail > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
