I like writing very short, commented routines, as shown here: http://www.jsoftware.com/jwiki/DevonMcCormick/DLA/SeekingRelease .
On Thu, May 15, 2014 at 5:23 PM, Kip Murray <[email protected]> wrote: > How does one write understandable J? I offer my newt adverb below which > uses spaces to promote understandability. > > Another technique might be Linda's "bottom up" style of first showing > pieces then putting the pieces together. What are your techniques? Please > illustrate. > > We would like at least to understand our own code when we come back to it! > > NB. Newton's method > > newt =: 1 : 0 > t =. y > h =. 1 % 512 > whilst. t ~: s do. > s =. t > t =. s - +: h * (u s) % (u s + h) - u s - h > h =. h % 2 > end. > t > ) > (2 - *:) newt 2 NB. Find root of 2 - *: near 2 > 1.41421 > (2 - *:) newt _2 NB. Find a root near _2 > _1.41421 > > > > -- > Sent from Gmail Mobile > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > -- Devon McCormick, CFA ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
