Re: [Jprogramming] OpenGL

2020-03-04 Thread Brian Schott
Bill, Following your great recommendation I created the verb `right` below. right=: 3 : 0 wh=. gl_qwh'' vd=. (gl_Rotate y, 0 0 1) mp~ 0,.~_3]\_1 fc vertexData p=. symdat <'vertexData' d=. 1&fc ,vd d memw p,0,(#d),2 gl_sel HD gl_paint'' ) After running the script I can see that `vertexData` has b

Re: [Jprogramming] ^:

2020-03-04 Thread Raul Miller
Ah, yes... I was taking the length of the representation from 3!:1 as the size of the array. You're right that that would leave out some memory management values. That said, while I have seen m {~^:n or ^&m^:n get used (and that one tends to be used with a list value for n), I have not seen }.^:n

Re: [Jprogramming] ^:

2020-03-04 Thread Henry Rich
It's hard to know what typical is.  Selection is pretty common, as are reshape, take, and drop, and they can operate on data without moving it.  Perhaps the most common operations are arithmetic, and they can be performed in place much of the time. Many operations, like u;.1, u/, u"n, can opera

Re: [Jprogramming] ^:

2020-03-04 Thread Raul Miller
Hmmm... We're working with rank 1 lists here, so 40 bytes overhead for each array. Also, I think we should assume a 64 bit J implementation, so another 8 bytes for each value in these arrays. So... 'a' would be 800040 bytes and 'b' would be 80 bytes. Anyways... the expression b { 999 ,~ ] a

Re: [Jprogramming] ^:

2020-03-04 Thread Henry Rich
It's hard to know what the interpreter might get away with.  How many bytes will be used by the last sentence in this sequence?    a =. 1e5 ?@$ 1e5    ]b =. a i. 4 5 6 7 8 10 4592 7680 5095 18231    b { 999 ,~ ] a 999 5 6 7 8 Henry Rich On 3/4/2020 1:19 PM, Raul Miller wrote:

Re: [Jprogramming] ^:

2020-03-04 Thread Raul Miller
Unless you're working with memory mapped files -- which are a reflection of an external (os) mechanism -- named nouns in J are copy on write. For example: a=:p:i.4 b=:a a=:a 1}~ 9 a 2 9 5 7 b 2 3 5 7 Thanks, -- Raul On Wed, Mar 4, 2020 at 1:14 PM Hauke Rehr wrote: > > talking a

Re: [Jprogramming] ^:

2020-03-04 Thread Henry Rich
J uses reference counts on blocks, and makes a copy whenever a block is modified and there is need to keep the unmodified version. Henry Rich On 3/4/2020 1:14 PM, Hauke Rehr wrote: talking about copying: I don’t remember having read about whether J is copy-on-write or when copying will take pl

Re: [Jprogramming] ^:

2020-03-04 Thread Hauke Rehr
talking about copying: I don’t remember having read about whether J is copy-on-write or when copying will take place is there a defined set of verbs that does copying or does that take place at a different level? Am 04.03.20 um 15:29 schrieb Raul Miller: Yes. The general case, implementated in

Re: [Jprogramming] ^:

2020-03-04 Thread Raul Miller
Yes. The general case, implementated in J, would be more like >(, <@u)^:n But, also, if side effects are involved, then computational efficiency of the ^: implementation will often not be the key priority. And... copying is one of the faster operations that computers support. Not the fastest, b

Re: [Jprogramming] ^:

2020-03-04 Thread Henry Rich
(,u)^:n is a clever form.  It does do a lot of copying, which is what the JE design is trying to avoid; and if u returns a list it will produce a list rather than a table. I think it's harsh to say that the code with restarts is not 'working right'.  It just has the side effect.  I agree that

Re: [Jprogramming] ^:

2020-03-04 Thread Raul Miller
And if you do need to keep the results, something like (,u)^:n would do it... That said, I hope the other forms are fixable and get fixed to work right. (Working correctly should take precedence over working fast, and in the extreme cases where that's a significant problem, that just means you nee