On 11/8/07, Dan Bron <[EMAIL PROTECTED]> wrote:
> Raul said:
> > I have not found anything in J's dictionary conflicting with
> > this behavior.
>
> Well, the Dictionary explicitly forbids it:
>
> NB. http://www.jsoftware.com/help/dictionary/d310n.htm
> 2605 174 qdoj ':'
> 2. The explicit result is the result of the last
> non-test block sentence executed; that result
> must be a noun in the 3 : and 4 : cases.
>
> NB. http://www.jsoftware.com/help/dictionary/errors.htm
> 5684 239 qdoj 'errors'
> syntax error ) the result of a sentence is not a
> noun/verb/adverb/conjunction; a verb
> attempting to produce a verb/adverb/
> conjunction result
Of course a gerund is a noun.
That said, these parts of the dictionary would probably need to
be revised, to avoid confusion, if this change were made.
> OTOH, I believe this change is large and subtle, and for those
> reasons requires exceptional justification. IMO your example
> does not suffice:
My example, was intended as motivation more than justification.
Justification requires agreeing that constructing gerunds based
on data would be useful.
> > That would eliminate the trailing `'''' from explicit verbs
> > like
> > 3 :'+/,([-.-.)&y`'''''&>
>
> You could achieve the same result now, without the quote characters:
>
> 3 : '+/,([-.-.)&y`(i.0)' NB. Or $~0 or ;a: etc.
These are equivalent, though more verbose. ($0) would be
equivalent but no more verbose.
> 3 : '+/,{.([-.-.)&y`]'
This is not equivalent. This results in a gerund list of length 2,
where the earlier expressions resulted in a single gerund.
> BTW, I don't quite understand your code's intentions, but did you mean:
>
> 3 : '([:+/ , [-.-.)&y`(i.0)'
Actually, I meant 3 : '([:+/ [-.-.)&y`(i.0)'
(You have written a hook with [: as the primary verb. I put the
comma in there because "it worked", not because I
thought things through.)
> instead? The way you've written it, it looks like you'll make a gerund of
> ([-.-.)&, then ravel that, then sum it. Since the ravel of the gerund is a
> 1-atom list, the sum does nothing.
Yeah -- oops.
Thanks,
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm