Recently I enjoyed producing the sequence of
triangular numbers through the following code:

   +/\}.i.>:

In addition to using this directly in the console, I
was able to abstract this into a verb,

   triangularSeries=: +/\@:}.@:i.@:>:

and to make a similar verb that returns only the
specified item of the sequence:

   triangularNumber=: +/\}.@:i.@:>:

(I know that atop (@) is equilalent to @: for these
definitions. We can discuss this in terms of either or
both conjunctions.)

I sort-of understand why the conjunctions are required
when defining verbs, but not required when entering
literal command-line entries. I think this is because
when used in a command line the primaries are
interpreted in the context of the data at hand,
whereas a definition must interpret the primaries more
abstractly.  I cannot simply define triangularSeries
to be +/\}.i.>: because applying named verbs does not
entail substituting text, then interpreting it. 
Instead, it involves applying nouns to the previously
interpreted verb. Or, such is my grasp as of this
morning.

The weakness of my understanding is indicated by the
fact that I not only defined  triangularNumber
entirely by accident, I have not yet comprehended how
it works. I was attempting to define triangularSeries 
more minimally, having imagined that the first
conjuntion was redundant.  Not so. The omission
created a different, and also useful, verb.

I figured that having removed a conjunction I had
created a hook, (the left portion being +/\) but that
guess did not clarify my examination.

Please help me understand why triangularNumber does
what it does.  Thank you.

Tracy


       
____________________________________________________________________________________
Be a better Globetrotter. Get better travel answers from someone who knows. 
Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545469
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to