In this thread there has been a focus on the visual appearance of the output. But many of the functions fail what I consider a basic requirement in many programming situations.
We can get visual identity, but the displayed objects may be of different shape or type. If the objective is purely to produce a pretty display then conversion to literal may be fine. If it is to create a result which is to be used in further calculations it may not. After my post Dan Lettow suggested off line that I should incorporate ": in future solutions. I looked at it, drafted a simple addendum to my post but did not post it. Now that we have some more solutions it is clear that Linda's problem specification is not really adequate in a J environment. (1) We need to specify the ranks of the function, or some very powerful defaults will be applied. If we want the full power of insert then the default is _ _ _ . I think there are strong grounds for wanting to preserve that. To handle what Kip called extreme cases, it was suggested that the arguments should be converted to vectors. That is fine for functions defined over a pair of numeric scalars. We might want to generalise that in many different ways. Suppose we had two tables of points with three coordinates, and wish to tabulate some function dependent on them - perhaps the distance between them. The function in table need not be of rank 0 0 though that is the commonest form used for illustration. Linda's problem was interpreted by most contributors as writing a function for rank 1 arguments on left and right and the table function as having rank 0. (2)If we are to preserve fidelity then we need to consider the type of the result. Again several contributors have proposed solutions in which some of the boxed displays are literal. That gives a pretty display, but it is not true to the original argument. A sum of a numeric and a literal vector does not make sense. One thing we often find in J is that a structure which is based on the algorithmic needs is different from the best way of presenting the information. There is a need for a table function which preserves all features of the J objects, but also a need for a listtable function which displays the results using forms which assist visual interpretation. They are different needs and we should recognize them. In statistical programs having both table and listtable which operates on the result a table call is a common way of dealing with this. (3) Sometimes it is easier to build up a set of results of interest and then assemble them. Someone may have suggested it, but if they have I did not notice it. table4 adopts that approach. table4 =: 2 2 $ '';];([:,.[);+/ It works when the left argument is of rank 0 or 1 but it is not totally satisfactory visually and does not work at all well otherwise. Linda raised a very simple problem. Her intuition that it would raise interesting and important issues has indeed been true. ----- Original Message ----- ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
