There are no rules that I know of regarding names. I tend to use lowercase names for verbs.
GLOBALS with capitals, often in special locales. Use convenient telling names. Use lovercase short local names for temporary assignments within verbs. Use many lines and clear code for your own utilities. Write code and test it from scripts. Use J standard utilities as required and not copied in. Use labs and demos to learn from. Use fif to find examples. Use each for looping. Write short control verbs. - Björn Helgason gsm:6985532 skype:gosiminn On 19.4.2014 00:44, "Joe Bogner" <[email protected]> wrote: > Björn - Thanks for the ideas. I like the idea of fst or having a standard > symbol / character for it. > > R.E. Boss - Using the _ for subscript will come in handy if I am posting > code somewhere that automatically converts to LaTex like stackoverflow. > > Dan - I appreciate the alternate thinking. I didn't even consider subscript > as a 1-cell of an array. I also assumed it's best to mimic the notation in > the paper, but I can see the advantages of deviating. I think I'll start > with staying close to the paper and then refactor to improve it once I'm > comfortable I've implemented it correctly. > > Thanks > Joe > > > On Fri, Apr 18, 2014 at 6:17 PM, Dan Bron <[email protected]> wrote: > > > 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 > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
