> It's somewhat stunning that Dijkstra was an opponent of APL after reading this paper.
That was my reaction years ago after reading some of the EWDs. See: http://archive.vector.org.uk/art10501260 On Thu, May 15, 2014 at 2:58 PM, Marshall Lochbaum <[email protected]>wrote: > One technique that I use it to use spacing to denote precedence, with > the operations that are evaluated first spaced closer together. Thus the > long line in your newt function might be written > t =. s - +: h * (u s) % (u s+h) - (u s-h) > . I have left in the parentheses on the right side to emphasize the > symmetry in the denominator. I have also grouped (+: h * (u s)) as if it > were evaluated first, even though it isn't here, because ordering it > like that does not (in theory) change the final result and because in > mathematics we would probably write something like > (2*h*u(s)) / (u(s+h)-u(s-h)) > . Another option would be to rewrite as > t =. s - (+: h * u s) % (u s+h) - (u s-h) > . > > Most J programmers do this to some extent by writing adverbs and > conjuntions next to verbs without spaces and putting spaces between > verbs, but I found the concept actually expressed in Dijkstra's EWD > #1300, "The notational conventions I adopted, and why". It's somewhat > stunning that Dijkstra was an opponent of APL after reading this paper. > > (transcription) > https://www.cs.utexas.edu/users/EWD/transcriptions/EWD13xx/EWD1300.html > (scan) > https://www.cs.utexas.edu/users/EWD/ewd13xx/EWD1300.PDF > > Marshall > > On Thu, May 15, 2014 at 04:23:15PM -0500, Kip Murray 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 > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
