Henry, I have just been working on translating "Probability in APL" into 
"Probability in J".

Running this script works nicely until a snag in  ac .I haven't translated it 
gracefully yet. 

Also, it would be great if I could have it load 'dissect' in the script.

NB. PROBABILITY IN APL TRANSLATED INTO
NB. PROBABILITY IN J - LINDA ALVORD

NB. pOSSIBLE OUTCOMES
po=: 13 :'|:y#:i.*/y'
po

NB. CORRECTION MATRIX
cm=: 13 :'(*/y)(#"0) 0,}:+/\y'
cm

NB. POSSIBLE OUTCOMES AS CHARACTERS
poc=: 13 :'y{~(po + cm)x'
poc

NB. ALTERNATE POSSIBLE OUTCOMES
cmalt=: 13 :'(_1}.+/\0,y)+/(*/y)#0'
cmalt

NB. ALL POSSIBLE COMBINATIONS
ac=:(# # 2:) poc [: , ' '"_ ,. ]
ac 'ABCD'
ac

ds 'po 2 3 4'
ds 'cm 2 3 4'
ds '2 3 4 poc ''%#123ABCD'''
ds 'cmalt 2 3 4'

ac 'ABCD'

ds 'ac ''ABCD'

Linda 

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Henry Rich
Sent: Friday, May 31, 2013 10:44 PM
To: [email protected]
Subject: Re: [Jbeta] gl2 formatting issues

OK, thanks, will do.

Meanwhile, a little progress.

Going back through my code I find that gl2 for J6 required me to add 1 to wh to 
make rectangles abut properly.  When I remove this kludge for
J8 it fixes the clipping problem.

It appears that character extents for Arial font are not reported correctly, 
which induces me to allocate a wider box for the string than necessary, which 
makes things look skewed to the left.  This problem is still active & I will 
get more info.

I experimented with adding values to w&h and nothing gets rid of the lines 
between abutting rectangles.  I am inclining with Bill to curse 
the pen.   I use pen 0 5, i. e. 0 width, PS_NULL.  This problem is still 
active.

Henry Rich

On 5/31/2013 10:32 PM, bill lam wrote:
> Please look at the section source in
> http://www.jsoftware.com/jwiki/Guides/Qt%20IDE
>
> gl2 is implmemented in the file lib/wd/gl2.cpp
>
> Пт, 31 май 2013, Henry Rich писал(а):
>> You might be right there.  The lines between the rects seem to be a 
>> darker version of the rectangle color.  I have set the pen to null - 
>> perhaps that is not being handled properly.
>>
>> Can you point me to the Qt C++ source?
>>
>> Henry Rich
>>
>> On 5/31/2013 10:16 PM, bill lam wrote:
>>> This is the definition of glrect in gl2:
>>>
>>> glrect x y w h ; draw rectangle with pen and brush
>>>
>>> This is its implementation in Qt C++
>>>
>>> int glrect (const int *p)
>>> {
>>>    if (!isigraph) return 1;
>>>    Isigraph2 *w = (Isigraph2 *)isigraph->widget;
>>>    if (!w->painter) return 1;
>>>    if (!w->painter->isActive()) return 1;
>>>    w->painter->drawRect (*(p), *(p + 1), *(p + 2), *(p + 3));
>>>    return 0;
>>> }
>>>
>>> This is from Qt documentation
>>>
>>> void QPainter::drawRect ( int x, int y, int width, int height )
>>>
>>> This is an overloaded function.
>>>
>>> Draws a rectangle with upper left corner at (x, y) and with the 
>>> given width and height.
>>>
>>>
>>> So that I think the current glrect implementation is correct.
>>> The issue you got might be related to pen and brush.
>>>
>>> Пт, 31 май 2013, Henry Rich писал(а):
>>>> OK.
>>>>
>>>> A series of rectangles with the same y values and adjoining in x, 
>>>> such that x+w of one = x of the next, do not abut smoothly.
>>>>
>>>> I don't know how Qt describes rectangles: is it xywh or tlbr?  But 
>>>> somehow the gl2 definition leaves gaps when drawn in Qt.
>>>>
>>>> Henry Rich
>>>>
>>>> On 5/31/2013 7:35 PM, chris burke wrote:
>>>>> In general, we want things to work the way Qt works. That is 
>>>>> simplest for us, and the best way forward.
>>>>>
>>>>> If a discrepancy between J6 and J8 arises because of the way we 
>>>>> have coded it, then we will fix it, but not if it arises because 
>>>>> Qt differs from J6 jwdw or jwdp.
>>>>>
>>>>> On Sat, Jun 1, 2013 at 7:18 AM, Henry Rich <[email protected]> wrote:
>>>>>
>>>>>> Try loading the dissect package (just released) in J6 and J8, and 
>>>>>> see the differences.  In particular, look at the sentence display 
>>>>>> at the top of the graphics window - in J8 it shows rectangle boundaries.
>>>>>>
>>>>>> Also, see how the display of shape and rank information (above 
>>>>>> the
>>>>>> results) seems to be uncentered in the rectangle.
>>>>>>
>>>>>> Also, the Arial font seems to size differently in J8 than in J6.
>>>>>>
>>>>>> Do you agree that the graphics should look the same between J6 
>>>>>> and J8? If so, I will work on characterizing the differences.
>>>>>>
>>>>>> Remember to upgrade your grid before installing dissect.
>>>>>>
>>>>>> Henry Rich
>>>>>>
>>>>>>
>>>>>> On 5/31/2013 7:10 PM, bill lam wrote:
>>>>>>
>>>>>>> Reactively, I suspect that the way how Qt works.  Please provide 
>>>>>>> simple script and screen shots to illustrate the differences.
>>>>>>>
>>>>>>> Пт, 31 май 2013, Henry Rich писал(а):
>>>>>>>
>>>>>>>> gl2 for J8 has a number of incompatibilities with J6, and also 
>>>>>>>> just seems a pixel off in some cases.  Since there will be 
>>>>>>>> graphics applications used on both J6 and J8 for a while yet, 
>>>>>>>> it seems to me that J8 ought to do things the J6 way when there is no 
>>>>>>>> reason not to.
>>>>>>>>
>>>>>>>> What I have found so far:
>>>>>>>>
>>>>>>>> 0.  glarc seems to go CW around the ellipse; J6 went CCW
>>>>>>>>
>>>>>>>> 1.  drawing abutting rectangles, with the same color and no 
>>>>>>>> pen, should leave a smooth field; in J8 there are visible 
>>>>>>>> joints
>>>>>>>>
>>>>>>>> 2.  drawing text inside a box, the text seems to be shifted one 
>>>>>>>> pixel to the left.  Or maybe the box is one pixel to the right.
>>>>>>>>
>>>>>>>> 3.  When I draw a box with a pen just inside the wdclip 
>>>>>>>> rectangle, the right and bottom are chopped off.  In J6 the 
>>>>>>>> cliprect was already one row/col too short; j8 is even shorter.  
>>>>>>>> This may be related to item 2.
>>>>>>>>
>>>>>>>> This weekend I will release a graphics application for J6 and 
>>>>>>>> J8.  It formats properly on J6, and exhibits pixel problems on J8.
>>>>>>>>
>>>>>>>> Henry Rich
>>>>>>>> ------------------------------**------------------------------*
>>>>>>>> *
>>>>>>>> ----------
>>>>>>>> For information about J forums see 
>>>>>>>> http://www.jsoftware.com/**forums.htm<http://www.jsoftware.com/
>>>>>>>> forums.htm>
>>>>>>>>
>>>>>>>
>>>>>>>   
>>>>>>> ------------------------------**------------------------------**
>>>>>> ----------
>>>>>> For information about J forums see 
>>>>>> http://www.jsoftware.com/**forums.htm<http://www.jsoftware.com/fo
>>>>>> rums.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
>>>
>> ---------------------------------------------------------------------
>> - 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