Joe Bogner wrote:
>  I realize this is a very basic question but was wondering if anyone has 
>  any conventions or tips that work for them when dealing with subscripts 
>  and superscripts.

Compared to most programming languages, J programs do little name
management.  

Instead, we try to manage (anonymous) data flows, pouring information into
verbs and catching it as it comes out the other end.  Names are (for the
most part) reserved for higher-order concepts such as verbs, adverbs, and
conjunctions.

Of course, J is not a pure functional language, so we can and sometimes do
manage state through global named nouns, but to the extent we can minimize
that, we do.

Fortunately, J is a "think big" kind of language, so we have a number of
tools available to minimize the numbers of names we must manage.  In
particular, one common pattern is step back and take as broad a view as
possible, when it comes to data structures. 

Often that means introducing new dimensions to our data structures (so we
can capture as large a regularity, or pattern, as possible).  In other
words, I recommend:

   F =:  0.000080 0.000055 0.000185 0.000108 ,: 0.000073 0.000043 0.000150
0.000071

   U  =:  0.023 0.192 0.140 0.645 ,:  0.027 0.127 0.197 0.649

   0 { F
   t { F NB. If t varies, so much the better!

   0 { u
   t { u

In other words, if your task calls for subscripts, use subscripts!

-Dan

PS:  For an example of direct transliteration of standard mathematical
notation with sub/superscripts using names instead of indexing, see Tom
Allen's tensor experiments on the J wiki:

http://www.jsoftware.com/jwiki/Essays/Tensor%20Experiments/TensorExperiments02

I'm no physicist, so I'm speaking from ignorance, but my take of these
scripts, on a surface level, is this approach of naming subscripts gets
unwieldy, fast.



----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to