Your answer looks good.  I run code I want to put in an email in a script and 
run it in JHS.  Then I copy it in an Outlook email after I changed to rich 
text.  

In J802 boxes would display correctly.

In J803 the boxes look good in the sent folder but appear in boxes with dashes. 
 Also, not an anddition line feed seems to be added even if I do not change to 
rich text or html.  The emails don’t look very good.

How did you prepare this helpful message?

Linda  

-----Original Message-----
From: programming-boun...@forums.jsoftware.com 
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of robert therriault
Sent: Thursday, September 25, 2014 2:01 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Predicting the shape of the result

Hi Chris,

Well there is information on the vocabulary page for Table  
http://www.jsoftware.com/help/dictionary/d420.htm

also Nuvoc has good information on this verb  
http://www.jsoftware.com/jwiki/Vocabulary/slash#dyadic

The actual shape of a box is empty since the box is an atom. In the case of 1 2 
+/ i. 4 the shape is actually 2 4 i.e. 2 rows of 4 not 2 1

   < 1 2 +/ i. 4
┌───────┐
│1 2 3 4│
│2 3 4 5│
└───────┘
   $ < 1 2 +/ i. 4
   $ each < 1 2 +/ i. 4
┌───┐
│2 4│
└───┘
   
If you wanted the two rows to be in their own boxes then you could do

   ;/  1 2 +/ i. 4 
┌───────┬───────┐
│1 2 3 4│2 3 4 5│
└───────┴───────┘
   or

   <"1 [ 1 2 +/ i. 4
┌───────┬───────┐
│1 2 3 4│2 3 4 5│
└───────┴───────┘
  
   $ <"1 [ 1 2 +/ i. 4
2
 
The above shows that the shape of the two boxes is not actually 1 2 because 
each box is an atom the shape is actually just 2.

You are correct that an understanding of rank and shape is key to getting J to 
work for you. If you are looking for information I have always found Henry 
Rich's J for C Programmers much more accessible than the J dictionary.  
Chapters 5 and 6 are really good at explaining rank and shape with regard to 
verbs. http://www.jsoftware.com/help/jforc/contents.htm

Also, look at Nuvoc on the wiki. This is a crowd sourced resource organized by 
Ian Clark and Henry Rich which many have found useful.  
http://www.jsoftware.com/jwiki/NuVoc

Enjoy the ride as you learn J. Welcome aboard.

Cheers, bob 

 
On Sep 24, 2014, at 10:35 PM, Chris Wright <cawright...@gmail.com> wrote:

> Hi
> 
> Could I work out from the docs that
> 
>  < 1 2 +/ i. 4
> 
> ┌───────┐
> 
> │1 2 3 4│
> 
> │2 3 4 5│
> 
> └───────┘
> 
> will give the above (2 1) shape result
> 
> 
> and not a (1 2) result like below?
> 
> 
> ┌───────┬───────┐
> 
> │1 2 3 4│2 3 4 5│
> 
> └───────┴───────┘
> 
> 
> 
> 
> With the (2,1) it's obvious that two 1-cells are returned,  and with (1,2)
> it's not obvious (where is the boundary b/n them), but I wonder if I could
> have worked out the shape of the output from the docs alone?
> 
> 
> with thanks
> 
> 
> Chris
> ----------------------------------------------------------------------
> 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

Reply via email to