Raul,
Thank you especially for translating the code
examples in Neville's original posting. Only with your
result was I able to reread and appreciate the original
posting.
On Mon, 26 Nov 2007, Raul Miller wrote:
+ On Nov 26, 2007 2:32 AM, neville holmes <[EMAIL PROTECTED]> wrote:
+
+ First, if I were teaching J, I would impose a line length limit on
+ acceptable results. I would reject anything longer than 25
+ J words, maybe (or some other arbitrarily chosen limit -- perhaps
+ chosen for the entire class or perhaps chosen for each assignment),
+ and ask them to rewrite any such thing (or mark it as a failure if
+ they fail to do so). I might also impose a minimum line length
+ restriction where only one word's definition may be less than this
+ minimum length. (Ten J words, maybe.)
+
I am having a little trouble with the idea of a
minimum requirement on the number of words. Some very short
definitions are very helpful especially when a definition
is reused.
Instead I think I would place emphasis on students
being exposed to examples of clearly developed multiple line
definitions created by J masters and then giving students
(extra) credit for following such examples. This is quite an
art especially for tacit code, imo.
+ To motivate these constraints, I might spend a few minutes
+ talking about poetry and its construction. (Note also that the
+ above constraints are mere possibilities.)
+
+ Since sample could have been rewritten:
+
+ samples=: {. + (1&{ - {.) * (i.@>: % ])@[EMAIL PROTECTED]:
+ sdefault=: (1 0 2{ ], 0 0 0.01}.~ #) : ((] ,~ 0 0 0.01 (}.~-) #)@(] , [EMAIL
PROTECTED]))
+ sample=: [EMAIL PROTECTED]
+
I hope documentation using Note like you have below
catches on in the J community, to.
+ Note ''
+ sdefault 7 is 0 7 0.01
+ sdefault 3 7 is 3 7 0.01
+ sdefault 3 7 0.5 is 3 7 0.5
+ 2 sdefault 7 is 0 7 0.5
+ 2 sdefault 3 7 is 3 7 0.5
+ )
+
I agree with your next few paragraphs.
+ I would be strongly tempted to introduce constraints and intermediate
+ step problems for that assignment (if I repeated it) which would guide
+ the student towards this style of solution.
+
+ I would even more strongly be tempted to guide students towards a
+ style of defaults which can be more easily documented.
+
+ Second, while I agree that retaining comments in tacit definitions
+ could be nice, from a code reading point of view, I should also
+ point out that well chosen names can serve an analogous role.
+
What a clever approach to cleaning up the code:
using an adverb definition for a noun. Great!
+
+ sam=: ''1 :(0 :0-.LF)
+ (({. + {: * i.@(>.@((1&{ - {.) % {:))) ,
+ 1&{)@(3&{.@(({.~ (# + _3&*@(1: = #))) ,
+ %&100@(-~/@(_2&{.))))
+
+ :([EMAIL PROTECTED] ([EMAIL PROTECTED] + ((1&[EMAIL PROTECTED] - [EMAIL
PROTECTED]) % [) *
+ i.@(1: + [)) (>@(2&>@#) |. 2&{.)@])
+ )
+
+
[snip]
+
+ I believe that J's control-F1 functionality can be made to work for user
+ defined code, but I have not studied its mechanisms and can not say
+ how easy or obnoxious this would be (with or without some helper utility).
I assume your paragraph above is an attempt to offer
an alternative to Neville's (or his associate's) annoyance
that NB.s following a tacit definition get lost. It is
unfortunate that the only automatic way to document tacit
definitions is with clever naming. If the suffixed NB.
text could be automatically added to u b. 2 for tacit verbs,
that would be really slick, I think. But there may be
problems with that approach.
+
+ --
+ Raul
+
Thank you, again for your contributions,
(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm