table
1 : (':'; '(((#~LF-.@e.])5!:5<''u'');,.y),.({.;}.)":x,y u/x')~


2011/11/21 Björn Helgason <[email protected]>

> table4 not table
>
> a=:2 3 5
>    b=:0 1 2 3
>    table4 =: 2 2 $ '';];([:,.[);+/
>    a table4 b
> ┌─┬───────┐
> │ │0 1 2 3│
> ├─┼───────┤
> │2│2 3 4 5│
> │3│3 4 5 6│
> │5│5 6 7 8│
> └─┴───────┘
>
> 2011/11/21 Linda Alvord <[email protected]>
>
>> My role was to create simple problems that students could understand
>> fully,
>> so they would be ready for the graduate courses you describe. All the
>> issues
>> like rank are useless when they do not yet have an appreciation for the
>> elegance of a vector.
>>
>> Your comments could form the basis for an excellent syllabus for a course
>> in
>> J at the college level!  In addition, they should raise questions the you
>> programmers on this forum will need to understand as they are ready.
>>
>> Maybe there are changes in j701 that are causing this not to work.
>> I'll leave this one for the real computer wizards.
>>
>>
>>  table4 =: 2 2 $ '';];([:,.[);+/
>>     a=:2 3 5
>>    b=:0 1 2 3
>>     a table b
>> |domain error
>> |   (((#~LF-.@e.])5!:5<'u');,.y),.({.;}.)":x,y     u/x
>>
>>
>>
>> -----Original Message-----
>> From: [email protected]
>> [mailto:[email protected]] On Behalf Of Fraser Jackson
>> Sent: Sunday, November 20, 2011 3:19 PM
>> To: Programming forum
>> Subject: Re: [Jprogramming] table challenge in simple J
>>
>> 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
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
>
>
> --
> Björn Helgason, Verkfræðingur
> Fornustekkum II
> 781 Hornafirði,
> t-póst: [email protected]
> gsm: +3546985532
> twitter: @flugfiskur
> http://groups.google.com/group/J-Programming
>
>
> Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans
>
> góður kennari getur stigið á tær án þess að glansinn fari af skónum
>           /|_      .-----------------------------------.
>          ,'  .\  /  | Með léttri lund verður        |
>      ,--'    _,'   | Dagurinn í dag                     |
>     /       /       | Enn betri en gærdagurinn  |
>    (   -.  |        `-----------------------------------'
>    |     ) |         (\_ _/)
>   (`-.  '--.)       (='.'=)   ♖♘♗♕♔♙
>    `. )----'        (")_(") ☃☠
>



-- 
Björn Helgason, Verkfræðingur
Fornustekkum II
781 Hornafirði,
t-póst: [email protected]
gsm: +3546985532
twitter: @flugfiskur
http://groups.google.com/group/J-Programming


Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans

góður kennari getur stigið á tær án þess að glansinn fari af skónum
          /|_      .-----------------------------------.
         ,'  .\  /  | Með léttri lund verður        |
     ,--'    _,'   | Dagurinn í dag                     |
    /       /       | Enn betri en gærdagurinn  |
   (   -.  |        `-----------------------------------'
   |     ) |         (\_ _/)
  (`-.  '--.)       (='.'=)   ♖♘♗♕♔♙
   `. )----'        (")_(") ☃☠
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to