Re: [Jprogramming] Global Symbols Table 0 s: 10

2023-03-14 Thread Ak O
Thank you for your help!

Ak.

On Tue., Mar. 14, 2023, 07:25 Henry Rich,  wrote:

> Rather than describe it, I have written you verbs to convert symbols
> into a list of boxed strings and vice versa.  It is up to you to apply
> the verbs, save results, etc.:
>
> NB. Returns currently-defined symbols, as (list of characters);(list of
> symbol lengths)
> getsyms =: {{
> indexes =. 0 0 -.~ 2 {."1(0) s: 2   NB. (index,length) of each symbol
> symchars =. (,"0 indexes) ;@:(<;.0) 0 s: 3   NB. fetch each symbol and
> run them together
> symchars ; {:"1 indexes
> }}
>
> NB. Applies to result of getsyms, to create boxed strings.  Apply s: to
> result if desired
> setsyms =: {{
> 'chars lens' =. y
> ((,:~"0   [: |.!.0 +/\) lens) <;.0 chars  NB. create start,:length of
> each string and box them
> }}
>
> The documentation of /what/ s: does is at
> https://www.jsoftware.com/help/dictionary/dsco.htm .  /How/ it does it
> is to be learned from the source code, and you are own your own there.
> There are a few comments.
>
> Henry Rich
>
> On 3/14/2023 1:04 AM, Ak O wrote:
> > lol a few, and I expect many more.
> >
> > What command restores each in their correct position
> > Store is?
> >   (3!:1)  (0 s: 3) 1!:2<...'
> >   (3!:1) (2 {."1(0) s: 2) 1!:2 <...'
> > Restore?
> >   ???(3!:2) 1!:1<...'
> >   ???(3!:2) 1!:1<...'
> >
> > Also, I  wonder if there is a resource I can consult
> > to understand  better how the Symbols Interpreter works?
> >
> > Thanks again
> >
> > Ak.
> >
> >
> >
> > On Mon., Mar. 13, 2023, 20:15 Henry Rich,  wrote:
> >
> >> You must have a lot of symbols.
> >>
> >> A symbol represents a list of characters.  If you are trying to
> >> save/restore the symbols, 0 s: 10 is giving much more information th
> >> you need.  All you need is the list of strings run end-to-end (0 s: 3)
> >> and the index/lenpgth of each (2 {."1 (0) s: 2) .
> >>
> >> Henry Rich.m
> >>
> >> On 3/13/2023 9:02 PM, Ak O wrote:
> >>> I hope you are all well.
> >>>
> >>> Is there a mechanism for storing the Global Symbols Data in parts? Also
> >>> restoring from those parts?
> >>>
> >>> The documented methods of:
> >>>((3!:1) 0 s: 10) 1!:2<'symb_tbl_dat.dat'
> >>>10 s: (3!:2)1!:1<'symb_tbl_dat.dat'
> >>>
> >>> had been working well but now seems to have hit a limit.
> >>> When I try to store the GST, I  now trigger the out of memory error.
> >>>
> >>> I thought about storing the columns individually.
> >>>((3!:1)0{(0 s: 10)) 1!:2<'symb_tbl_col_0.dat'
> >>>...7{(0 s: 10)...
> >>>
> >>> I cannot seem to 'install' the columns to restore the whole table.
> >>>
> >>> Is there some way chunking the Global Symbols Data into pieces?
> >>> Or pack it more tightly?
> >>>
> >>> Or some other thing I might not have considered?
> >>>
> >>>
> >>> Thanks
> >>>
> >>> Ak
> >>> --
> >>> 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


Re: [Jprogramming] Glo.bal Symbols Table 0 s: 10

2023-03-14 Thread Henry Rich
Rather than describe it, I have written you verbs to convert symbols 
into a list of boxed strings and vice versa.  It is up to you to apply 
the verbs, save results, etc.:


NB. Returns currently-defined symbols, as (list of characters);(list of 
symbol lengths)

getsyms =: {{
indexes =. 0 0 -.~ 2 {."1(0) s: 2   NB. (index,length) of each symbol
symchars =. (,"0 indexes) ;@:(<;.0) 0 s: 3   NB. fetch each symbol and 
run them together

symchars ; {:"1 indexes
}}

NB. Applies to result of getsyms, to create boxed strings.  Apply s: to 
result if desired

setsyms =: {{
'chars lens' =. y
((,:~"0   [: |.!.0 +/\) lens) <;.0 chars  NB. create start,:length of 
each string and box them

}}

The documentation of /what/ s: does is at 
https://www.jsoftware.com/help/dictionary/dsco.htm .  /How/ it does it 
is to be learned from the source code, and you are own your own there.  
There are a few comments.


Henry Rich

On 3/14/2023 1:04 AM, Ak O wrote:

lol a few, and I expect many more.

What command restores each in their correct position
Store is?
  (3!:1)  (0 s: 3) 1!:2<...'
  (3!:1) (2 {."1(0) s: 2) 1!:2 <...'
Restore?
  ???(3!:2) 1!:1<...'
  ???(3!:2) 1!:1<...'

Also, I  wonder if there is a resource I can consult
to understand  better how the Symbols Interpreter works?

Thanks again

Ak.



On Mon., Mar. 13, 2023, 20:15 Henry Rich,  wrote:


You must have a lot of symbols.

A symbol represents a list of characters.  If you are trying to
save/restore the symbols, 0 s: 10 is giving much more information th
you need.  All you need is the list of strings run end-to-end (0 s: 3)
and the index/lenpgth of each (2 {."1 (0) s: 2) .

Henry Rich.m

On 3/13/2023 9:02 PM, Ak O wrote:

I hope you are all well.

Is there a mechanism for storing the Global Symbols Data in parts? Also
restoring from those parts?

The documented methods of:
   ((3!:1) 0 s: 10) 1!:2<'symb_tbl_dat.dat'
   10 s: (3!:2)1!:1<'symb_tbl_dat.dat'

had been working well but now seems to have hit a limit.
When I try to store the GST, I  now trigger the out of memory error.

I thought about storing the columns individually.
   ((3!:1)0{(0 s: 10)) 1!:2<'symb_tbl_col_0.dat'
   ...7{(0 s: 10)...

I cannot seem to 'install' the columns to restore the whole table.

Is there some way chunking the Global Symbols Data into pieces?
Or pack it more tightly?

Or some other thing I might not have considered?


Thanks

Ak
--
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


Re: [Jprogramming] Glo.bal Symbols Table 0 s: 10

2023-03-13 Thread Ak O
lol a few, and I expect many more.

What command restores each in their correct position
Store is?
 (3!:1)  (0 s: 3) 1!:2<...'
 (3!:1) (2 {."1(0) s: 2) 1!:2 <...'
Restore?
 ???(3!:2) 1!:1<...'
 ???(3!:2) 1!:1<...'

Also, I  wonder if there is a resource I can consult
to understand  better how the Symbols Interpreter works?

Thanks again

Ak.



On Mon., Mar. 13, 2023, 20:15 Henry Rich,  wrote:

> You must have a lot of symbols.
>
> A symbol represents a list of characters.  If you are trying to
> save/restore the symbols, 0 s: 10 is giving much more information th
> you need.  All you need is the list of strings run end-to-end (0 s: 3)
> and the index/lenpgth of each (2 {."1 (0) s: 2) .
>
> Henry Rich.m
>
> On 3/13/2023 9:02 PM, Ak O wrote:
> > I hope you are all well.
> >
> > Is there a mechanism for storing the Global Symbols Data in parts? Also
> > restoring from those parts?
> >
> > The documented methods of:
> >   ((3!:1) 0 s: 10) 1!:2<'symb_tbl_dat.dat'
> >   10 s: (3!:2)1!:1<'symb_tbl_dat.dat'
> >
> > had been working well but now seems to have hit a limit.
> > When I try to store the GST, I  now trigger the out of memory error.
> >
> > I thought about storing the columns individually.
> >   ((3!:1)0{(0 s: 10)) 1!:2<'symb_tbl_col_0.dat'
> >   ...7{(0 s: 10)...
> >
> > I cannot seem to 'install' the columns to restore the whole table.
> >
> > Is there some way chunking the Global Symbols Data into pieces?
> > Or pack it more tightly?
> >
> > Or some other thing I might not have considered?
> >
> >
> > Thanks
> >
> > Ak
> > --
> > 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


Re: [Jprogramming] Global Symbols Table 0 s: 10

2023-03-13 Thread Henry Rich

You must have a lot of symbols.

A symbol represents a list of characters.  If you are trying to 
save/restore the symbols, 0 s: 10 is giving much more information than 
you need.  All you need is the list of strings run end-to-end (0 s: 3) 
and the index/length of each (2 {."1 (0) s: 2) .


Henry Rich

On 3/13/2023 9:02 PM, Ak O wrote:

I hope you are all well.

Is there a mechanism for storing the Global Symbols Data in parts? Also
restoring from those parts?

The documented methods of:
  ((3!:1) 0 s: 10) 1!:2<'symb_tbl_dat.dat'
  10 s: (3!:2)1!:1<'symb_tbl_dat.dat'

had been working well but now seems to have hit a limit.
When I try to store the GST, I  now trigger the out of memory error.

I thought about storing the columns individually.
  ((3!:1)0{(0 s: 10)) 1!:2<'symb_tbl_col_0.dat'
  ...7{(0 s: 10)...

I cannot seem to 'install' the columns to restore the whole table.

Is there some way chunking the Global Symbols Data into pieces?
Or pack it more tightly?

Or some other thing I might not have considered?


Thanks

Ak
--
For information about J forums see http://www.jsoftware.com/forums.htm


--
For information about J forums see http://www.jsoftware.com/forums.htm


[Jprogramming] Global Symbols Table 0 s: 10

2023-03-13 Thread Ak O
I hope you are all well.

Is there a mechanism for storing the Global Symbols Data in parts? Also
restoring from those parts?

The documented methods of:
 ((3!:1) 0 s: 10) 1!:2<'symb_tbl_dat.dat'
 10 s: (3!:2)1!:1<'symb_tbl_dat.dat'

had been working well but now seems to have hit a limit.
When I try to store the GST, I  now trigger the out of memory error.

I thought about storing the columns individually.
 ((3!:1)0{(0 s: 10)) 1!:2<'symb_tbl_col_0.dat'
 ...7{(0 s: 10)...

I cannot seem to 'install' the columns to restore the whole table.

Is there some way chunking the Global Symbols Data into pieces?
Or pack it more tightly?

Or some other thing I might not have considered?


Thanks

Ak
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] p. _78 _1 0 0 0 1

2023-02-05 Thread Henry Rich
Good find & fix.  (i>>3)&8 was an attempt to fix earlier similar 
problems, and it did fix the ones that were reported!  The 8 was a 
blunder, I meant 7.  You are right that i&7 suffices.


Henry Rich

On 2/4/2023 11:07 PM, Elijah Stone wrote:
I think the j implementation does exactly the same thing as the julia 
and bqn implementations:


if(!--kicktimer){kicktimer=CSZ1; 
x=zplus(x,ztymes(dx,zrj0(cyclefracs[(i>>3)&8])));


Actually, now that I look at it, that's wrong.  I'm not sure what 
(i>>3)&8 was supposed to be, but if I replace it with i&7, the code 
works fine.


On Sat, 4 Feb 2023, Henry Rich wrote:


That might well be what I'm seeing.

The J implementation tries Laguerre, and if it fails perturbs the 
polynomial by 1e_12 in the leading coefficient.  Do you think it 
would be better if instead I retried with a random starting point?


I haven't checked for what the region of convergence of the starting 
point is.


hhr

On 2/4/2023 9:55 PM, Marshall Lochbaum wrote:

Tried out my own Laguerre implementation from here:

https://github.com/mlochbaum/bqn-libs/blob/master/polynomial.bqn#L80-L113 



I remember I used J as a reference for this, but I think I ended up
following this one in Julia:


https://github.com/giordano/PolynomialRoots.jl/blob/master/src/PolynomialRoots.jl#L255 



With the starting point at 0 it converges, but only with a few random
adjustments from this line:

 { 0=jump_i|i ? root +↩ dx × Jump i÷jump_i ;@}

Here Jump i÷jump_i just ignores the argument and produces a random
float, ?0 in J (Julia has a table to avoid computing one).

Removing this, I see a small region of non-convergence around 0, radius
between 0.1 and 0.2. I suppose this isn't what you get?

Marshall

On Sat, Feb 04, 2023 at 08:34:46PM -0500, Henry Rich wrote:

Somehow I lost the original post.

For some reason Laguerre's method doesn't converge for this 
polynomial.
There seem to be large regions of non-convergence. Changes of up to 
1e_5 

in

any of the constants still fail to converge.

The point seems to oscillate in a wide range but doesn't head 
toward any

solution.  In the implementation the initial guess is always 0j0.

I don't see why this would fail.  If anyone on this list can help, or 

knows

someone who can help, I'd appreciate suggestions.

Henry Rich
--
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


Re: [Jprogramming] p. _78 _1 0 0 0 1

2023-02-04 Thread Elijah Stone
(Fix pushed.  Since CSZ1 has no factors in common with 8, i&7 should visit all 
elements of cyclefracs; not in any particular order, but that shouldn't 
matter.)


On Sat, 4 Feb 2023, Elijah Stone wrote:

I think the j implementation does exactly the same thing as the julia and bqn 
implementations:


if(!--kicktimer){kicktimer=CSZ1; 
x=zplus(x,ztymes(dx,zrj0(cyclefracs[(i>>3)&8])));


Actually, now that I look at it, that's wrong.  I'm not sure what (i>>3)&8 
was 
supposed to be, but if I replace it with i&7, the code works fine.


On Sat, 4 Feb 2023, Henry Rich wrote:


That might well be what I'm seeing.

The J implementation tries Laguerre, and if it fails perturbs the 
polynomial by 1e_12 in the leading coefficient.  Do you think it would 
be better if instead I retried with a random starting point?


I haven't checked for what the region of convergence of the starting 
point is.


hhr

On 2/4/2023 9:55 PM, Marshall Lochbaum wrote:

Tried out my own Laguerre implementation from here:

https://github.com/mlochbaum/bqn-libs/blob/master/polynomial.bqn#L80-L113

I remember I used J as a reference for this, but I think I ended up
following this one in Julia:





https://github.com/giordano/PolynomialRoots.jl/blob/master/src/PolynomialRoots.jl#L255


With the starting point at 0 it converges, but only with a few random
adjustments from this line:

 { 0=jump_i|i ? root +↩ dx × Jump i÷jump_i ;@}

Here Jump i÷jump_i just ignores the argument and produces a random
float, ?0 in J (Julia has a table to avoid computing one).

Removing this, I see a small region of non-convergence around 0, radius
between 0.1 and 0.2. I suppose this isn't what you get?

Marshall

On Sat, Feb 04, 2023 at 08:34:46PM -0500, Henry Rich wrote:

Somehow I lost the original post.

For some reason Laguerre's method doesn't converge for this polynomial.
There seem to be large regions of non-convergence. Changes of up to 1e_5 

in

any of the constants still fail to converge.

The point seems to oscillate in a wide range but doesn't head toward any
solution.  In the implementation the initial guess is always 0j0.

I don't see why this would fail.  If anyone on this list can help, or 

knows

someone who can help, I'd appreciate suggestions.

Henry Rich
--
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


Re: [Jprogramming] p. _78 _1 0 0 0 1

2023-02-04 Thread Elijah Stone
I think the j implementation does exactly the same thing as the julia and bqn 
implementations:


if(!--kicktimer){kicktimer=CSZ1; 
x=zplus(x,ztymes(dx,zrj0(cyclefracs[(i>>3)&8])));

Actually, now that I look at it, that's wrong.  I'm not sure what (i>>3)&8 was 
supposed to be, but if I replace it with i&7, the code works fine.


On Sat, 4 Feb 2023, Henry Rich wrote:


That might well be what I'm seeing.

The J implementation tries Laguerre, and if it fails perturbs the 
polynomial by 1e_12 in the leading coefficient.  Do you think it would 
be better if instead I retried with a random starting point?


I haven't checked for what the region of convergence of the starting 
point is.


hhr

On 2/4/2023 9:55 PM, Marshall Lochbaum wrote:

Tried out my own Laguerre implementation from here:

https://github.com/mlochbaum/bqn-libs/blob/master/polynomial.bqn#L80-L113

I remember I used J as a reference for this, but I think I ended up
following this one in Julia:



https://github.com/giordano/PolynomialRoots.jl/blob/master/src/PolynomialRoots.jl#L255


With the starting point at 0 it converges, but only with a few random
adjustments from this line:

 { 0=jump_i|i ? root +↩ dx × Jump i÷jump_i ;@}

Here Jump i÷jump_i just ignores the argument and produces a random
float, ?0 in J (Julia has a table to avoid computing one).

Removing this, I see a small region of non-convergence around 0, radius
between 0.1 and 0.2. I suppose this isn't what you get?

Marshall

On Sat, Feb 04, 2023 at 08:34:46PM -0500, Henry Rich wrote:

Somehow I lost the original post.

For some reason Laguerre's method doesn't converge for this polynomial.
There seem to be large regions of non-convergence. Changes of up to 1e_5 

in

any of the constants still fail to converge.

The point seems to oscillate in a wide range but doesn't head toward any
solution.  In the implementation the initial guess is always 0j0.

I don't see why this would fail.  If anyone on this list can help, or 

knows

someone who can help, I'd appreciate suggestions.

Henry Rich
--
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


Re: [Jprogramming] p. _78 _1 0 0 0 1

2023-02-04 Thread Henry Rich

It doesn't look like roundoff to me. Nonexpert opinion.

hhr

On 2/4/2023 10:04 PM, Elijah Stone wrote:
Is it possible the culprit is floating-point roundoff?  If so, perhaps 
the routine could be made to detect that automatically.  You can get a 
conservative estimation of floating-point roundoff by using interval 
arithmetic, directing the hardware to alternately round towards 
positive and negative infinity for each operation; when the estimated 
roundoff is larger than the refinement you made to your root estimate, 
the latter is likely junk, so you should fall back to some alternate 
strategy.


(When changing the rounding mode is somewhat expensive, as on x86 
before avx512, you can get a slightly looser--but still pretty 
good--estimate by multiplying by 1-2^-52 or 1+2^-52.  Those 'round' 
towards and away from zero, so some extra fanagling is required; this 
can be amortised by partitioning all terms according to sign, which is 
probably a good idea anyway.)


It could also be worth looking at other approaches.  Like I said 
before, I think bisection using intervals is a likely approach.  I 
also found this thesis 
https://www.math.stonybrook.edu/~scott/Papers/thesis-alt.pdf which 
talks about forcing newton to converge, which seems promising.


On Sat, 4 Feb 2023, Henry Rich wrote:


Somehow I lost the original post.

For some reason Laguerre's method doesn't converge for this 
polynomial.  There seem to be large regions of non-convergence. 
Changes of up to 1e_5 in any of the constants still fail to converge.


The point seems to oscillate in a wide range but doesn't head toward 
any solution.  In the implementation the initial guess is always 0j0.


I don't see why this would fail.  If anyone on this list can help, or 
knows someone who can help, I'd appreciate suggestions.


Henry Rich
--
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


Re: [Jprogramming] p. _78 _1 0 0 0 1

2023-02-04 Thread Henry Rich

That might well be what I'm seeing.

The J implementation tries Laguerre, and if it fails perturbs the 
polynomial by 1e_12 in the leading coefficient.  Do you think it would 
be better if instead I retried with a random starting point?


I haven't checked for what the region of convergence of the starting 
point is.


hhr

On 2/4/2023 9:55 PM, Marshall Lochbaum wrote:

Tried out my own Laguerre implementation from here:

https://github.com/mlochbaum/bqn-libs/blob/master/polynomial.bqn#L80-L113

I remember I used J as a reference for this, but I think I ended up
following this one in Julia:

https://github.com/giordano/PolynomialRoots.jl/blob/master/src/PolynomialRoots.jl#L255

With the starting point at 0 it converges, but only with a few random
adjustments from this line:

 { 0=jump_i|i ? root +↩ dx × Jump i÷jump_i ;@}

Here Jump i÷jump_i just ignores the argument and produces a random
float, ?0 in J (Julia has a table to avoid computing one).

Removing this, I see a small region of non-convergence around 0, radius
between 0.1 and 0.2. I suppose this isn't what you get?

Marshall

On Sat, Feb 04, 2023 at 08:34:46PM -0500, Henry Rich wrote:

Somehow I lost the original post.

For some reason Laguerre's method doesn't converge for this polynomial.
There seem to be large regions of non-convergence. Changes of up to 1e_5 in
any of the constants still fail to converge.

The point seems to oscillate in a wide range but doesn't head toward any
solution.  In the implementation the initial guess is always 0j0.

I don't see why this would fail.  If anyone on this list can help, or knows
someone who can help, I'd appreciate suggestions.

Henry Rich
--
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


Re: [Jprogramming] p. _78 _1 0 0 0 1

2023-02-04 Thread Elijah Stone
Is it possible the culprit is floating-point roundoff?  If so, perhaps the 
routine could be made to detect that automatically.  You can get a 
conservative estimation of floating-point roundoff by using interval 
arithmetic, directing the hardware to alternately round towards positive and 
negative infinity for each operation; when the estimated roundoff is larger 
than the refinement you made to your root estimate, the latter is likely junk, 
so you should fall back to some alternate strategy.


(When changing the rounding mode is somewhat expensive, as on x86 before 
avx512, you can get a slightly looser--but still pretty good--estimate by 
multiplying by 1-2^-52 or 1+2^-52.  Those 'round' towards and away from zero, 
so some extra fanagling is required; this can be amortised by partitioning all 
terms according to sign, which is probably a good idea anyway.)


It could also be worth looking at other approaches.  Like I said before, I 
think bisection using intervals is a likely approach.  I also found this 
thesis https://www.math.stonybrook.edu/~scott/Papers/thesis-alt.pdf which 
talks about forcing newton to converge, which seems promising.


On Sat, 4 Feb 2023, Henry Rich wrote:


Somehow I lost the original post.

For some reason Laguerre's method doesn't converge for this polynomial.  
There seem to be large regions of non-convergence. Changes of up to 1e_5 
in any of the constants still fail to converge.


The point seems to oscillate in a wide range but doesn't head toward any 
solution.  In the implementation the initial guess is always 0j0.


I don't see why this would fail.  If anyone on this list can help, or 
knows someone who can help, I'd appreciate suggestions.


Henry Rich
--
For information about J forums see http://www.jsoftware.com/forums.htm


--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] p. _78 _1 0 0 0 1

2023-02-04 Thread Marshall Lochbaum
Tried out my own Laguerre implementation from here:

https://github.com/mlochbaum/bqn-libs/blob/master/polynomial.bqn#L80-L113

I remember I used J as a reference for this, but I think I ended up
following this one in Julia:

https://github.com/giordano/PolynomialRoots.jl/blob/master/src/PolynomialRoots.jl#L255

With the starting point at 0 it converges, but only with a few random
adjustments from this line:

{ 0=jump_i|i ? root +↩ dx × Jump i÷jump_i ;@}

Here Jump i÷jump_i just ignores the argument and produces a random
float, ?0 in J (Julia has a table to avoid computing one).

Removing this, I see a small region of non-convergence around 0, radius
between 0.1 and 0.2. I suppose this isn't what you get?

Marshall

On Sat, Feb 04, 2023 at 08:34:46PM -0500, Henry Rich wrote:
> Somehow I lost the original post.
> 
> For some reason Laguerre's method doesn't converge for this polynomial. 
> There seem to be large regions of non-convergence. Changes of up to 1e_5 in
> any of the constants still fail to converge.
> 
> The point seems to oscillate in a wide range but doesn't head toward any
> solution.  In the implementation the initial guess is always 0j0.
> 
> I don't see why this would fail.  If anyone on this list can help, or knows
> someone who can help, I'd appreciate suggestions.
> 
> Henry Rich
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


[Jprogramming] p. _78 _1 0 0 0 1

2023-02-04 Thread Henry Rich

Somehow I lost the original post.

For some reason Laguerre's method doesn't converge for this polynomial.  
There seem to be large regions of non-convergence. Changes of up to 1e_5 
in any of the constants still fail to converge.


The point seems to oscillate in a wide range but doesn't head toward any 
solution.  In the implementation the initial guess is always 0j0.


I don't see why this would fail.  If anyone on this list can help, or 
knows someone who can help, I'd appreciate suggestions.


Henry Rich
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Thread Primitives -> Configuration 0 T.'' (T.)

2023-01-06 Thread Henry Rich
Am I missing something?  You have to give me enough to reproduce the 
problem from scratch.


I don't have My_*

It is not clear what sentence causes the problem, or what the expected 
result is.


I find it a little odd that you have created threads in threadpools 2 
and 3 but you are starting the tasks in threadpool 0.  Never mind that: 
please send me the sentences that fail.


Henry Rich

On 1/6/2023 12:36 PM, Ak O wrote:

load 'My_tools'

{{0 T. 2}}^:3''
{{0 T. 3}}^:3''

My_tabulation ; (My_u t. (<'worker';1)"1 My_y)


timespacex
  3.9 5.0e7 NB. (no t.'') Runs correctly.
  1.1 3.3e7 NB. (With t.'') Runs once, session dies


Ak


On Fri., Jan. 6, 2023, 08:10 Henry Rich,  wrote:


Tell me exactly what you did so I can reproduce it.

Henry Rich

On 1/6/2023 2:22 AM, Ak O wrote:

This form executes correctly once.
On the second run the whole session crashes.

JVERSION
Engine: j904/j64/windows
Beta-i: commercial/2022-12-13T15:22:35
Library: 9.04.07
Qt IDE: 2.0.3/6.2.4(6.2.4)
Platform:  Win 64
Installer: J904 install
InstallPath: c:/j904
Contact: www.jsoftware.com


Ak

On Thu., Jan. 5, 2023, 20:41 Henry Rich,  wrote:


Each execution of (u t. '') creates a task. The task is added to a list
of tasks for its threadpool.  When a thread in the threadpool becomes
available, it executes the task. That's all there is to it.

Execution starts immediately.  When you create a task, all the waiting
tasks in the threadpool are awakened, and one takes the task.  (yes,
maybe we should awaken fewer threads).  When a task completes, its
thread grabs another task if there is one.

You just create the tasks; we will execute them.  :)

Henry Rich

On 1/5/2023 9:41 PM, Ak O wrote:

On Tue Dec 20 17:52:26 UTC 2022

You suggested,
... or, if the blockverbs are the same, you could use

pyx012 =. blockverb t. ''"0 block0args;block1args;block2args...

I think is similar to what you suggest here.

Can explain how the execution is distributed?

When is the execution started?


Ak


On Thu., Jan. 5, 2023, 16:51 Henry Rich,  wrote:


You don't need multiple threadpools, or a work_list.  Just have
something like

tabulation_task@>/ x (?@[ A. i.@]) t. ''"0 y

Henry Rich

On 1/5/2023 6:38 PM, Ak O wrote:

Is this the correct way to consider scheduling? Is there a better way

to

structure the distribution of this execution?


Ak






NB. Simulated long running tasks, of variable execution length.

] wrk_prcs =: ([: < (1 ? [) A. ([: i. ]))"0 0
] x=. 90 31 235 77 83 99 17 62 122 23
] y=. 12 4 _17 8 5 _8 9 6 15 _4

NB. The solution pyx look like this:

  (x wrk_prcs y)

] notional_work_list =: ,.<;._1


',(<(1?90)A.(i.12)),(<(1?31)A.(i.4)),(<(1?235)A.(i._17)),(<(1?77)A.(i.8)),(<(1?83)A.(i.5)),(<(1?99)A.(i._8)),(<(1?17)A.(i.9)),(<(1?62)A.(i.6)),(<(1?122)A.(i.15)),(<(1?23)A.(i._4))

'

] Exec_sched_form1 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
)),(notional_work_list) ,."2 (,.10 $ <"_1 ( 1 +i.4))

NB. Execution is pre-assigned to threadpools. Intermediate results

are

locked from a calling tabulation task.
NB. The Final tabulation task executes when each pool has signaled

that

all

of its assigned tasks are complete.

] Exec_sched_form2 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
)),(notional_work_list) ,."2

(,.<"_1(1),(2),(3),(4),(_),(_),(_),(_),(_),(_))

NB. Threadpools are initialized with an execution task (passed a

task).

By

Thread configuration, on completion of
NB. an execution, the worker checks for remaining tasks (from the
Work_List). If there are no remaining tasks, the pool destroyed.
NB. If there are remaining tasks, the task is locked and executed by

the

worker. This series repeats to completion.
NB. When signaled the final tablution task is executed.


On Thu., Jan. 5, 2023, 03:40 Ak O,  wrote:


NB. Simulated long running tasks, of variable execution length.

] wrk_prcs =: ([: < (1 ? [) A. ([: i. ]))"0 0

] x=. 90 31 235 77 83 99 17 62 122 23
] y=. 12 4 _17 8 5 _8 9 6 15 _4

NB. The solution pyx look like this:

  (x wrk_prcs y)

] notional_work_list =: ,.<;._1


',(<(1?90)A.(i.12)),(<(1?31)A.(i.4)),(<(1?235)A.(i._17)),(<(1?77)A.(i.8)),(<(1?83)A.(i.5)),(<(1?99)A.(i._8)),(<(1?17)A.(i.9)),(<(1?62)A.(i.6)),(<(1?122)A.(i.15)),(<(1?23)A.(i._4))

'


] Exec_sched_form1 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
)),(notional_work_list) ,."2 (,.10 $ <"_1 ( 1 +i.4))

NB. Execution is pre-assigned to threadpools. Intermediate results

are

locked from a calling tabulation task.
NB. The Final tabulation task executes when each pool has signaled

that

all of its assigned tasks are complete.


] Exec_sched_form2 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
)),(notional_work_list) ,."2
(,.<"_1(1),(2),(3),(4),(_),(_),(_),(_),(_),(_))

NB. Threadpools are initialized with an execution task (passed a

task).

By

Thread configuration, on completion of
NB. an execution, the worker checks for remaining tasks (from the

Re: [Jprogramming] Thread Primitives -> Configuration 0 T.'' (T.)

2023-01-06 Thread Ak O
load 'My_tools'

{{0 T. 2}}^:3''
{{0 T. 3}}^:3''

My_tabulation ; (My_u t. (<'worker';1)"1 My_y)


timespacex
 3.9 5.0e7 NB. (no t.'') Runs correctly.
 1.1 3.3e7 NB. (With t.'') Runs once, session dies


Ak


On Fri., Jan. 6, 2023, 08:10 Henry Rich,  wrote:

> Tell me exactly what you did so I can reproduce it.
>
> Henry Rich
>
> On 1/6/2023 2:22 AM, Ak O wrote:
> > This form executes correctly once.
> > On the second run the whole session crashes.
> >
> > JVERSION
> > Engine: j904/j64/windows
> > Beta-i: commercial/2022-12-13T15:22:35
> > Library: 9.04.07
> > Qt IDE: 2.0.3/6.2.4(6.2.4)
> > Platform:  Win 64
> > Installer: J904 install
> > InstallPath: c:/j904
> > Contact: www.jsoftware.com
> >
> >
> > Ak
> >
> > On Thu., Jan. 5, 2023, 20:41 Henry Rich,  wrote:
> >
> >> Each execution of (u t. '') creates a task. The task is added to a list
> >> of tasks for its threadpool.  When a thread in the threadpool becomes
> >> available, it executes the task. That's all there is to it.
> >>
> >> Execution starts immediately.  When you create a task, all the waiting
> >> tasks in the threadpool are awakened, and one takes the task.  (yes,
> >> maybe we should awaken fewer threads).  When a task completes, its
> >> thread grabs another task if there is one.
> >>
> >> You just create the tasks; we will execute them.  :)
> >>
> >> Henry Rich
> >>
> >> On 1/5/2023 9:41 PM, Ak O wrote:
> >>>On Tue Dec 20 17:52:26 UTC 2022
> >>>
> >>> You suggested,
> >>>... or, if the blockverbs are the same, you could use
> >>>
> >>>pyx012 =. blockverb t. ''"0 block0args;block1args;block2args...
> >>>
> >>> I think is similar to what you suggest here.
> >>>
> >>> Can explain how the execution is distributed?
> >>>
> >>> When is the execution started?
> >>>
> >>>
> >>> Ak
> >>>
> >>>
> >>> On Thu., Jan. 5, 2023, 16:51 Henry Rich,  wrote:
> >>>
>  You don't need multiple threadpools, or a work_list.  Just have
>  something like
> 
>  tabulation_task@>/ x (?@[ A. i.@]) t. ''"0 y
> 
>  Henry Rich
> 
>  On 1/5/2023 6:38 PM, Ak O wrote:
> > Is this the correct way to consider scheduling? Is there a better way
> >> to
> > structure the distribution of this execution?
> >
> >
> > Ak
> >
> >
> >
> >
> >
> >
> > NB. Simulated long running tasks, of variable execution length.
> >
> > ] wrk_prcs =: ([: < (1 ? [) A. ([: i. ]))"0 0
> > ] x=. 90 31 235 77 83 99 17 62 122 23
> > ] y=. 12 4 _17 8 5 _8 9 6 15 _4
> >
> > NB. The solution pyx look like this:
> >
> >  (x wrk_prcs y)
> >
> > ] notional_work_list =: ,.<;._1
> >
> >>
> ',(<(1?90)A.(i.12)),(<(1?31)A.(i.4)),(<(1?235)A.(i._17)),(<(1?77)A.(i.8)),(<(1?83)A.(i.5)),(<(1?99)A.(i._8)),(<(1?17)A.(i.9)),(<(1?62)A.(i.6)),(<(1?122)A.(i.15)),(<(1?23)A.(i._4))
> > '
> >
> > ] Exec_sched_form1 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
> > )),(notional_work_list) ,."2 (,.10 $ <"_1 ( 1 +i.4))
> >
> > NB. Execution is pre-assigned to threadpools. Intermediate results
> are
> > locked from a calling tabulation task.
> > NB. The Final tabulation task executes when each pool has signaled
> that
>  all
> > of its assigned tasks are complete.
> >
> > ] Exec_sched_form2 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
> > )),(notional_work_list) ,."2
>  (,.<"_1(1),(2),(3),(4),(_),(_),(_),(_),(_),(_))
> > NB. Threadpools are initialized with an execution task (passed a
> task).
>  By
> > Thread configuration, on completion of
> > NB. an execution, the worker checks for remaining tasks (from the
> > Work_List). If there are no remaining tasks, the pool destroyed.
> > NB. If there are remaining tasks, the task is locked and executed by
> >> the
> > worker. This series repeats to completion.
> > NB. When signaled the final tablution task is executed.
> >
> >
> > On Thu., Jan. 5, 2023, 03:40 Ak O,  wrote:
> >
> >> NB. Simulated long running tasks, of variable execution length.
> >>
> >> ] wrk_prcs =: ([: < (1 ? [) A. ([: i. ]))"0 0
> >>
> >> ] x=. 90 31 235 77 83 99 17 62 122 23
> >> ] y=. 12 4 _17 8 5 _8 9 6 15 _4
> >>
> >> NB. The solution pyx look like this:
> >>
> >>  (x wrk_prcs y)
> >>
> >> ] notional_work_list =: ,.<;._1
> >>
> >>
> ',(<(1?90)A.(i.12)),(<(1?31)A.(i.4)),(<(1?235)A.(i._17)),(<(1?77)A.(i.8)),(<(1?83)A.(i.5)),(<(1?99)A.(i._8)),(<(1?17)A.(i.9)),(<(1?62)A.(i.6)),(<(1?122)A.(i.15)),(<(1?23)A.(i._4))
> >> '
> >>
> >>
> >> ] Exec_sched_form1 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
> >> )),(notional_work_list) ,."2 (,.10 $ <"_1 ( 1 +i.4))
> >>
> >> NB. Execution is pre-assigned to threadpools. Intermediate results
> are
> >> locked from a calling tabulation task.
> >> NB. The Final tabulation task 

Re: [Jprogramming] Thread Primitives -> Configuration 0 T.'' (T.)

2023-01-06 Thread Henry Rich

Tell me exactly what you did so I can reproduce it.

Henry Rich

On 1/6/2023 2:22 AM, Ak O wrote:

This form executes correctly once.
On the second run the whole session crashes.

JVERSION
Engine: j904/j64/windows
Beta-i: commercial/2022-12-13T15:22:35
Library: 9.04.07
Qt IDE: 2.0.3/6.2.4(6.2.4)
Platform:  Win 64
Installer: J904 install
InstallPath: c:/j904
Contact: www.jsoftware.com


Ak

On Thu., Jan. 5, 2023, 20:41 Henry Rich,  wrote:


Each execution of (u t. '') creates a task. The task is added to a list
of tasks for its threadpool.  When a thread in the threadpool becomes
available, it executes the task. That's all there is to it.

Execution starts immediately.  When you create a task, all the waiting
tasks in the threadpool are awakened, and one takes the task.  (yes,
maybe we should awaken fewer threads).  When a task completes, its
thread grabs another task if there is one.

You just create the tasks; we will execute them.  :)

Henry Rich

On 1/5/2023 9:41 PM, Ak O wrote:

   On Tue Dec 20 17:52:26 UTC 2022

You suggested,
   ... or, if the blockverbs are the same, you could use

   pyx012 =. blockverb t. ''"0 block0args;block1args;block2args...

I think is similar to what you suggest here.

Can explain how the execution is distributed?

When is the execution started?


Ak


On Thu., Jan. 5, 2023, 16:51 Henry Rich,  wrote:


You don't need multiple threadpools, or a work_list.  Just have
something like

tabulation_task@>/ x (?@[ A. i.@]) t. ''"0 y

Henry Rich

On 1/5/2023 6:38 PM, Ak O wrote:

Is this the correct way to consider scheduling? Is there a better way

to

structure the distribution of this execution?


Ak






NB. Simulated long running tasks, of variable execution length.

] wrk_prcs =: ([: < (1 ? [) A. ([: i. ]))"0 0
] x=. 90 31 235 77 83 99 17 62 122 23
] y=. 12 4 _17 8 5 _8 9 6 15 _4

NB. The solution pyx look like this:

 (x wrk_prcs y)

] notional_work_list =: ,.<;._1


',(<(1?90)A.(i.12)),(<(1?31)A.(i.4)),(<(1?235)A.(i._17)),(<(1?77)A.(i.8)),(<(1?83)A.(i.5)),(<(1?99)A.(i._8)),(<(1?17)A.(i.9)),(<(1?62)A.(i.6)),(<(1?122)A.(i.15)),(<(1?23)A.(i._4))

'

] Exec_sched_form1 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
)),(notional_work_list) ,."2 (,.10 $ <"_1 ( 1 +i.4))

NB. Execution is pre-assigned to threadpools. Intermediate results are
locked from a calling tabulation task.
NB. The Final tabulation task executes when each pool has signaled that

all

of its assigned tasks are complete.

] Exec_sched_form2 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
)),(notional_work_list) ,."2

(,.<"_1(1),(2),(3),(4),(_),(_),(_),(_),(_),(_))

NB. Threadpools are initialized with an execution task (passed a task).

By

Thread configuration, on completion of
NB. an execution, the worker checks for remaining tasks (from the
Work_List). If there are no remaining tasks, the pool destroyed.
NB. If there are remaining tasks, the task is locked and executed by

the

worker. This series repeats to completion.
NB. When signaled the final tablution task is executed.


On Thu., Jan. 5, 2023, 03:40 Ak O,  wrote:


NB. Simulated long running tasks, of variable execution length.

] wrk_prcs =: ([: < (1 ? [) A. ([: i. ]))"0 0

] x=. 90 31 235 77 83 99 17 62 122 23
] y=. 12 4 _17 8 5 _8 9 6 15 _4

NB. The solution pyx look like this:

 (x wrk_prcs y)

] notional_work_list =: ,.<;._1


',(<(1?90)A.(i.12)),(<(1?31)A.(i.4)),(<(1?235)A.(i._17)),(<(1?77)A.(i.8)),(<(1?83)A.(i.5)),(<(1?99)A.(i._8)),(<(1?17)A.(i.9)),(<(1?62)A.(i.6)),(<(1?122)A.(i.15)),(<(1?23)A.(i._4))

'


] Exec_sched_form1 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
)),(notional_work_list) ,."2 (,.10 $ <"_1 ( 1 +i.4))

NB. Execution is pre-assigned to threadpools. Intermediate results are
locked from a calling tabulation task.
NB. The Final tabulation task executes when each pool has signaled

that

all of its assigned tasks are complete.


] Exec_sched_form2 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
)),(notional_work_list) ,."2
(,.<"_1(1),(2),(3),(4),(_),(_),(_),(_),(_),(_))

NB. Threadpools are initialized with an execution task (passed a

task).

By

Thread configuration, on completion of
NB. an execution, the worker checks for remaining tasks (from the
Work_List). If there are no remaining tasks, the pool destroyed.
NB. If there are remaining tasks, the task is locked and executed by

the

worker. This series repeats to completion.
NB. When signaled the final tablution task is executed.



Ak


On Wed., Jan. 4, 2023, 22:14 Raul Miller, 

wrote:

It's also worth noting that threads do not spin down immediately --
they only spin down when they're idle.

And, as you have noted it's basically a stack of threads.

So what you'd have to do is spin down as many threads as necessary to
eliminate the thread you wish to eliminate and then spin back up the
threads which you wish to remain.

Or, shut down J completely and initialize a new instance of J with
your desired 

Re: [Jprogramming] Thread Primitives -> Configuration 0 T.'' (T.)

2023-01-05 Thread Ak O
This form executes correctly once.
On the second run the whole session crashes.

JVERSION
Engine: j904/j64/windows
Beta-i: commercial/2022-12-13T15:22:35
Library: 9.04.07
Qt IDE: 2.0.3/6.2.4(6.2.4)
Platform:  Win 64
Installer: J904 install
InstallPath: c:/j904
Contact: www.jsoftware.com


Ak

On Thu., Jan. 5, 2023, 20:41 Henry Rich,  wrote:

> Each execution of (u t. '') creates a task. The task is added to a list
> of tasks for its threadpool.  When a thread in the threadpool becomes
> available, it executes the task. That's all there is to it.
>
> Execution starts immediately.  When you create a task, all the waiting
> tasks in the threadpool are awakened, and one takes the task.  (yes,
> maybe we should awaken fewer threads).  When a task completes, its
> thread grabs another task if there is one.
>
> You just create the tasks; we will execute them.  :)
>
> Henry Rich
>
> On 1/5/2023 9:41 PM, Ak O wrote:
> >   On Tue Dec 20 17:52:26 UTC 2022
> >
> > You suggested,
> >   ... or, if the blockverbs are the same, you could use
> >
> >   pyx012 =. blockverb t. ''"0 block0args;block1args;block2args...
> >
> > I think is similar to what you suggest here.
> >
> > Can explain how the execution is distributed?
> >
> > When is the execution started?
> >
> >
> > Ak
> >
> >
> > On Thu., Jan. 5, 2023, 16:51 Henry Rich,  wrote:
> >
> >> You don't need multiple threadpools, or a work_list.  Just have
> >> something like
> >>
> >> tabulation_task@>/ x (?@[ A. i.@]) t. ''"0 y
> >>
> >> Henry Rich
> >>
> >> On 1/5/2023 6:38 PM, Ak O wrote:
> >>> Is this the correct way to consider scheduling? Is there a better way
> to
> >>> structure the distribution of this execution?
> >>>
> >>>
> >>> Ak
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> NB. Simulated long running tasks, of variable execution length.
> >>>
> >>> ] wrk_prcs =: ([: < (1 ? [) A. ([: i. ]))"0 0
> >>> ] x=. 90 31 235 77 83 99 17 62 122 23
> >>> ] y=. 12 4 _17 8 5 _8 9 6 15 _4
> >>>
> >>> NB. The solution pyx look like this:
> >>>
> >>> (x wrk_prcs y)
> >>>
> >>> ] notional_work_list =: ,.<;._1
> >>>
> >>
> ',(<(1?90)A.(i.12)),(<(1?31)A.(i.4)),(<(1?235)A.(i._17)),(<(1?77)A.(i.8)),(<(1?83)A.(i.5)),(<(1?99)A.(i._8)),(<(1?17)A.(i.9)),(<(1?62)A.(i.6)),(<(1?122)A.(i.15)),(<(1?23)A.(i._4))
> >>> '
> >>>
> >>> ] Exec_sched_form1 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
> >>> )),(notional_work_list) ,."2 (,.10 $ <"_1 ( 1 +i.4))
> >>>
> >>> NB. Execution is pre-assigned to threadpools. Intermediate results are
> >>> locked from a calling tabulation task.
> >>> NB. The Final tabulation task executes when each pool has signaled that
> >> all
> >>> of its assigned tasks are complete.
> >>>
> >>> ] Exec_sched_form2 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
> >>> )),(notional_work_list) ,."2
> >> (,.<"_1(1),(2),(3),(4),(_),(_),(_),(_),(_),(_))
> >>> NB. Threadpools are initialized with an execution task (passed a task).
> >> By
> >>> Thread configuration, on completion of
> >>> NB. an execution, the worker checks for remaining tasks (from the
> >>> Work_List). If there are no remaining tasks, the pool destroyed.
> >>> NB. If there are remaining tasks, the task is locked and executed by
> the
> >>> worker. This series repeats to completion.
> >>> NB. When signaled the final tablution task is executed.
> >>>
> >>>
> >>> On Thu., Jan. 5, 2023, 03:40 Ak O,  wrote:
> >>>
>  NB. Simulated long running tasks, of variable execution length.
> 
>  ] wrk_prcs =: ([: < (1 ? [) A. ([: i. ]))"0 0
> 
>  ] x=. 90 31 235 77 83 99 17 62 122 23
>  ] y=. 12 4 _17 8 5 _8 9 6 15 _4
> 
>  NB. The solution pyx look like this:
> 
>  (x wrk_prcs y)
> 
>  ] notional_work_list =: ,.<;._1
> 
> >>
> ',(<(1?90)A.(i.12)),(<(1?31)A.(i.4)),(<(1?235)A.(i._17)),(<(1?77)A.(i.8)),(<(1?83)A.(i.5)),(<(1?99)A.(i._8)),(<(1?17)A.(i.9)),(<(1?62)A.(i.6)),(<(1?122)A.(i.15)),(<(1?23)A.(i._4))
>  '
> 
> 
>  ] Exec_sched_form1 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
>  )),(notional_work_list) ,."2 (,.10 $ <"_1 ( 1 +i.4))
> 
>  NB. Execution is pre-assigned to threadpools. Intermediate results are
>  locked from a calling tabulation task.
>  NB. The Final tabulation task executes when each pool has signaled
> that
>  all of its assigned tasks are complete.
> 
> 
>  ] Exec_sched_form2 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
>  )),(notional_work_list) ,."2
>  (,.<"_1(1),(2),(3),(4),(_),(_),(_),(_),(_),(_))
> 
>  NB. Threadpools are initialized with an execution task (passed a
> task).
> >> By
>  Thread configuration, on completion of
>  NB. an execution, the worker checks for remaining tasks (from the
>  Work_List). If there are no remaining tasks, the pool destroyed.
>  NB. If there are remaining tasks, the task is locked and executed by
> the
>  worker. This series repeats to completion.
>  

Re: [Jprogramming] Thread Primitives -> Configuration 0 T.'' (T.)

2023-01-05 Thread Henry Rich
Each execution of (u t. '') creates a task. The task is added to a list 
of tasks for its threadpool.  When a thread in the threadpool becomes 
available, it executes the task. That's all there is to it.


Execution starts immediately.  When you create a task, all the waiting 
tasks in the threadpool are awakened, and one takes the task.  (yes, 
maybe we should awaken fewer threads).  When a task completes, its 
thread grabs another task if there is one.


You just create the tasks; we will execute them.  :)

Henry Rich

On 1/5/2023 9:41 PM, Ak O wrote:

  On Tue Dec 20 17:52:26 UTC 2022

You suggested,
  ... or, if the blockverbs are the same, you could use

  pyx012 =. blockverb t. ''"0 block0args;block1args;block2args...

I think is similar to what you suggest here.

Can explain how the execution is distributed?

When is the execution started?


Ak


On Thu., Jan. 5, 2023, 16:51 Henry Rich,  wrote:


You don't need multiple threadpools, or a work_list.  Just have
something like

tabulation_task@>/ x (?@[ A. i.@]) t. ''"0 y

Henry Rich

On 1/5/2023 6:38 PM, Ak O wrote:

Is this the correct way to consider scheduling? Is there a better way to
structure the distribution of this execution?


Ak






NB. Simulated long running tasks, of variable execution length.

] wrk_prcs =: ([: < (1 ? [) A. ([: i. ]))"0 0
] x=. 90 31 235 77 83 99 17 62 122 23
] y=. 12 4 _17 8 5 _8 9 6 15 _4

NB. The solution pyx look like this:

(x wrk_prcs y)

] notional_work_list =: ,.<;._1


',(<(1?90)A.(i.12)),(<(1?31)A.(i.4)),(<(1?235)A.(i._17)),(<(1?77)A.(i.8)),(<(1?83)A.(i.5)),(<(1?99)A.(i._8)),(<(1?17)A.(i.9)),(<(1?62)A.(i.6)),(<(1?122)A.(i.15)),(<(1?23)A.(i._4))

'

] Exec_sched_form1 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
)),(notional_work_list) ,."2 (,.10 $ <"_1 ( 1 +i.4))

NB. Execution is pre-assigned to threadpools. Intermediate results are
locked from a calling tabulation task.
NB. The Final tabulation task executes when each pool has signaled that

all

of its assigned tasks are complete.

] Exec_sched_form2 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
)),(notional_work_list) ,."2

(,.<"_1(1),(2),(3),(4),(_),(_),(_),(_),(_),(_))

NB. Threadpools are initialized with an execution task (passed a task).

By

Thread configuration, on completion of
NB. an execution, the worker checks for remaining tasks (from the
Work_List). If there are no remaining tasks, the pool destroyed.
NB. If there are remaining tasks, the task is locked and executed by the
worker. This series repeats to completion.
NB. When signaled the final tablution task is executed.


On Thu., Jan. 5, 2023, 03:40 Ak O,  wrote:


NB. Simulated long running tasks, of variable execution length.

] wrk_prcs =: ([: < (1 ? [) A. ([: i. ]))"0 0

] x=. 90 31 235 77 83 99 17 62 122 23
] y=. 12 4 _17 8 5 _8 9 6 15 _4

NB. The solution pyx look like this:

(x wrk_prcs y)

] notional_work_list =: ,.<;._1


',(<(1?90)A.(i.12)),(<(1?31)A.(i.4)),(<(1?235)A.(i._17)),(<(1?77)A.(i.8)),(<(1?83)A.(i.5)),(<(1?99)A.(i._8)),(<(1?17)A.(i.9)),(<(1?62)A.(i.6)),(<(1?122)A.(i.15)),(<(1?23)A.(i._4))

'


] Exec_sched_form1 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
)),(notional_work_list) ,."2 (,.10 $ <"_1 ( 1 +i.4))

NB. Execution is pre-assigned to threadpools. Intermediate results are
locked from a calling tabulation task.
NB. The Final tabulation task executes when each pool has signaled that
all of its assigned tasks are complete.


] Exec_sched_form2 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
)),(notional_work_list) ,."2
(,.<"_1(1),(2),(3),(4),(_),(_),(_),(_),(_),(_))

NB. Threadpools are initialized with an execution task (passed a task).

By

Thread configuration, on completion of
NB. an execution, the worker checks for remaining tasks (from the
Work_List). If there are no remaining tasks, the pool destroyed.
NB. If there are remaining tasks, the task is locked and executed by the
worker. This series repeats to completion.
NB. When signaled the final tablution task is executed.



Ak


On Wed., Jan. 4, 2023, 22:14 Raul Miller, 

wrote:

It's also worth noting that threads do not spin down immediately --
they only spin down when they're idle.

And, as you have noted it's basically a stack of threads.

So what you'd have to do is spin down as many threads as necessary to
eliminate the thread you wish to eliminate and then spin back up the
threads which you wish to remain.

Or, shut down J completely and initialize a new instance of J with
your desired thread pool structure.

(That said... why would you want to restructure your thread pools like
this?)

--
Raul

On Wed, Jan 4, 2023 at 8:33 PM Ak O  wrote:

In a case where,
   {{0 T. 2}}''
   {{0 T. 4}}''
   {{0 T. 7}}''

How do I spin down the thread in pool number 4?

I think operation,
   {{55 T. ''}}
spins down only the most recently created thread.


Thank you Henry.

Ak



On Wed., Jan. 4, 2023, 16:29 Henry Rich, 

wrote:


[Jprogramming] Thread Primitives -> Configuration 0 T.'' (T.)

2023-01-05 Thread Ak O
 On Tue Dec 20 17:52:26 UTC 2022

You suggested,
 ... or, if the blockverbs are the same, you could use

 pyx012 =. blockverb t. ''"0 block0args;block1args;block2args...

I think is similar to what you suggest here.

Can explain how the execution is distributed?

When is the execution started?


Ak


On Thu., Jan. 5, 2023, 16:51 Henry Rich,  wrote:

> You don't need multiple threadpools, or a work_list.  Just have
> something like
>
> tabulation_task@>/ x (?@[ A. i.@]) t. ''"0 y
>
> Henry Rich
>
> On 1/5/2023 6:38 PM, Ak O wrote:
> > Is this the correct way to consider scheduling? Is there a better way to
> > structure the distribution of this execution?
> >
> >
> > Ak
> >
> >
> >
> >
> >
> >
> > NB. Simulated long running tasks, of variable execution length.
> >
> > ] wrk_prcs =: ([: < (1 ? [) A. ([: i. ]))"0 0
> > ] x=. 90 31 235 77 83 99 17 62 122 23
> > ] y=. 12 4 _17 8 5 _8 9 6 15 _4
> >
> > NB. The solution pyx look like this:
> >
> >(x wrk_prcs y)
> >
> > ] notional_work_list =: ,.<;._1
> >
> ',(<(1?90)A.(i.12)),(<(1?31)A.(i.4)),(<(1?235)A.(i._17)),(<(1?77)A.(i.8)),(<(1?83)A.(i.5)),(<(1?99)A.(i._8)),(<(1?17)A.(i.9)),(<(1?62)A.(i.6)),(<(1?122)A.(i.15)),(<(1?23)A.(i._4))
> > '
> >
> > ] Exec_sched_form1 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
> > )),(notional_work_list) ,."2 (,.10 $ <"_1 ( 1 +i.4))
> >
> > NB. Execution is pre-assigned to threadpools. Intermediate results are
> > locked from a calling tabulation task.
> > NB. The Final tabulation task executes when each pool has signaled that
> all
> > of its assigned tasks are complete.
> >
> > ] Exec_sched_form2 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
> > )),(notional_work_list) ,."2
> (,.<"_1(1),(2),(3),(4),(_),(_),(_),(_),(_),(_))
> >
> > NB. Threadpools are initialized with an execution task (passed a task).
> By
> > Thread configuration, on completion of
> > NB. an execution, the worker checks for remaining tasks (from the
> > Work_List). If there are no remaining tasks, the pool destroyed.
> > NB. If there are remaining tasks, the task is locked and executed by the
> > worker. This series repeats to completion.
> > NB. When signaled the final tablution task is executed.
> >
> >
> > On Thu., Jan. 5, 2023, 03:40 Ak O,  wrote:
> >
> >>
> >> NB. Simulated long running tasks, of variable execution length.
> >>
> >> ] wrk_prcs =: ([: < (1 ? [) A. ([: i. ]))"0 0
> >>
> >> ] x=. 90 31 235 77 83 99 17 62 122 23
> >> ] y=. 12 4 _17 8 5 _8 9 6 15 _4
> >>
> >> NB. The solution pyx look like this:
> >>
> >>(x wrk_prcs y)
> >>
> >> ] notional_work_list =: ,.<;._1
> >>
> ',(<(1?90)A.(i.12)),(<(1?31)A.(i.4)),(<(1?235)A.(i._17)),(<(1?77)A.(i.8)),(<(1?83)A.(i.5)),(<(1?99)A.(i._8)),(<(1?17)A.(i.9)),(<(1?62)A.(i.6)),(<(1?122)A.(i.15)),(<(1?23)A.(i._4))
> >> '
> >>
> >>
> >> ] Exec_sched_form1 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
> >> )),(notional_work_list) ,."2 (,.10 $ <"_1 ( 1 +i.4))
> >>
> >> NB. Execution is pre-assigned to threadpools. Intermediate results are
> >> locked from a calling tabulation task.
> >> NB. The Final tabulation task executes when each pool has signaled that
> >> all of its assigned tasks are complete.
> >>
> >>
> >> ] Exec_sched_form2 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
> >> )),(notional_work_list) ,."2
> >> (,.<"_1(1),(2),(3),(4),(_),(_),(_),(_),(_),(_))
> >>
> >> NB. Threadpools are initialized with an execution task (passed a task).
> By
> >> Thread configuration, on completion of
> >> NB. an execution, the worker checks for remaining tasks (from the
> >> Work_List). If there are no remaining tasks, the pool destroyed.
> >> NB. If there are remaining tasks, the task is locked and executed by the
> >> worker. This series repeats to completion.
> >> NB. When signaled the final tablution task is executed.
> >>
> >>
> >>
> >> Ak
> >>
> >>
> >> On Wed., Jan. 4, 2023, 22:14 Raul Miller, 
> wrote:
> >>
> >>> It's also worth noting that threads do not spin down immediately --
> >>> they only spin down when they're idle.
> >>>
> >>> And, as you have noted it's basically a stack of threads.
> >>>
> >>> So what you'd have to do is spin down as many threads as necessary to
> >>> eliminate the thread you wish to eliminate and then spin back up the
> >>> threads which you wish to remain.
> >>>
> >>> Or, shut down J completely and initialize a new instance of J with
> >>> your desired thread pool structure.
> >>>
> >>> (That said... why would you want to restructure your thread pools like
> >>> this?)
> >>>
> >>> --
> >>> Raul
> >>>
> >>> On Wed, Jan 4, 2023 at 8:33 PM Ak O  wrote:
>  In a case where,
>    {{0 T. 2}}''
>    {{0 T. 4}}''
>    {{0 T. 7}}''
> 
>  How do I spin down the thread in pool number 4?
> 
>  I think operation,
>    {{55 T. ''}}
>  spins down only the most recently created thread.
> 
> 
>  Thank you Henry.
> 
>  Ak
> 
> 
> 
>  On 

Re: [Jprogramming] Thread Primitives -> Configuration 0 T.'' (T.)

2023-01-05 Thread Henry Rich
You don't need multiple threadpools, or a work_list.  Just have 
something like


tabulation_task@>/ x (?@[ A. i.@]) t. ''"0 y

Henry Rich

On 1/5/2023 6:38 PM, Ak O wrote:

Is this the correct way to consider scheduling? Is there a better way to
structure the distribution of this execution?


Ak






NB. Simulated long running tasks, of variable execution length.

] wrk_prcs =: ([: < (1 ? [) A. ([: i. ]))"0 0
] x=. 90 31 235 77 83 99 17 62 122 23
] y=. 12 4 _17 8 5 _8 9 6 15 _4

NB. The solution pyx look like this:

   (x wrk_prcs y)

] notional_work_list =: ,.<;._1
',(<(1?90)A.(i.12)),(<(1?31)A.(i.4)),(<(1?235)A.(i._17)),(<(1?77)A.(i.8)),(<(1?83)A.(i.5)),(<(1?99)A.(i._8)),(<(1?17)A.(i.9)),(<(1?62)A.(i.6)),(<(1?122)A.(i.15)),(<(1?23)A.(i._4))
'

] Exec_sched_form1 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
)),(notional_work_list) ,."2 (,.10 $ <"_1 ( 1 +i.4))

NB. Execution is pre-assigned to threadpools. Intermediate results are
locked from a calling tabulation task.
NB. The Final tabulation task executes when each pool has signaled that all
of its assigned tasks are complete.

] Exec_sched_form2 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
)),(notional_work_list) ,."2 (,.<"_1(1),(2),(3),(4),(_),(_),(_),(_),(_),(_))

NB. Threadpools are initialized with an execution task (passed a task). By
Thread configuration, on completion of
NB. an execution, the worker checks for remaining tasks (from the
Work_List). If there are no remaining tasks, the pool destroyed.
NB. If there are remaining tasks, the task is locked and executed by the
worker. This series repeats to completion.
NB. When signaled the final tablution task is executed.


On Thu., Jan. 5, 2023, 03:40 Ak O,  wrote:



NB. Simulated long running tasks, of variable execution length.

] wrk_prcs =: ([: < (1 ? [) A. ([: i. ]))"0 0

] x=. 90 31 235 77 83 99 17 62 122 23
] y=. 12 4 _17 8 5 _8 9 6 15 _4

NB. The solution pyx look like this:

   (x wrk_prcs y)

] notional_work_list =: ,.<;._1
',(<(1?90)A.(i.12)),(<(1?31)A.(i.4)),(<(1?235)A.(i._17)),(<(1?77)A.(i.8)),(<(1?83)A.(i.5)),(<(1?99)A.(i._8)),(<(1?17)A.(i.9)),(<(1?62)A.(i.6)),(<(1?122)A.(i.15)),(<(1?23)A.(i._4))
'


] Exec_sched_form1 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
)),(notional_work_list) ,."2 (,.10 $ <"_1 ( 1 +i.4))

NB. Execution is pre-assigned to threadpools. Intermediate results are
locked from a calling tabulation task.
NB. The Final tabulation task executes when each pool has signaled that
all of its assigned tasks are complete.


] Exec_sched_form2 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
)),(notional_work_list) ,."2
(,.<"_1(1),(2),(3),(4),(_),(_),(_),(_),(_),(_))

NB. Threadpools are initialized with an execution task (passed a task). By
Thread configuration, on completion of
NB. an execution, the worker checks for remaining tasks (from the
Work_List). If there are no remaining tasks, the pool destroyed.
NB. If there are remaining tasks, the task is locked and executed by the
worker. This series repeats to completion.
NB. When signaled the final tablution task is executed.



Ak


On Wed., Jan. 4, 2023, 22:14 Raul Miller,  wrote:


It's also worth noting that threads do not spin down immediately --
they only spin down when they're idle.

And, as you have noted it's basically a stack of threads.

So what you'd have to do is spin down as many threads as necessary to
eliminate the thread you wish to eliminate and then spin back up the
threads which you wish to remain.

Or, shut down J completely and initialize a new instance of J with
your desired thread pool structure.

(That said... why would you want to restructure your thread pools like
this?)

--
Raul

On Wed, Jan 4, 2023 at 8:33 PM Ak O  wrote:

In a case where,
  {{0 T. 2}}''
  {{0 T. 4}}''
  {{0 T. 7}}''

How do I spin down the thread in pool number 4?

I think operation,
  {{55 T. ''}}
spins down only the most recently created thread.


Thank you Henry.

Ak



On Wed., Jan. 4, 2023, 16:29 Henry Rich,  wrote:


Yes, that's right.

Henry
On 1/4/

Rich

2023 6:11 PM, Ak O wrote:

Happy New Year,

I hope you are all well.

I am still struggling, please continue to have patience with me.


Where,
   {{0 T. ''}}''
creates a new thread.

Does this,
   {{0 T. 7}}''
create a new thread in pool number 7? Or how is this function

treated?

Thank you,

Ak


--

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



[Jprogramming] Thread Primitives -> Configuration 0 T.'' (T.)

2023-01-05 Thread Ak O
Is this the correct way to consider scheduling? Is there a better way to
structure the distribution of this execution?


Ak






NB. Simulated long running tasks, of variable execution length.

] wrk_prcs =: ([: < (1 ? [) A. ([: i. ]))"0 0
] x=. 90 31 235 77 83 99 17 62 122 23
] y=. 12 4 _17 8 5 _8 9 6 15 _4

NB. The solution pyx look like this:

  (x wrk_prcs y)

] notional_work_list =: ,.<;._1
',(<(1?90)A.(i.12)),(<(1?31)A.(i.4)),(<(1?235)A.(i._17)),(<(1?77)A.(i.8)),(<(1?83)A.(i.5)),(<(1?99)A.(i._8)),(<(1?17)A.(i.9)),(<(1?62)A.(i.6)),(<(1?122)A.(i.15)),(<(1?23)A.(i._4))
'

] Exec_sched_form1 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
)),(notional_work_list) ,."2 (,.10 $ <"_1 ( 1 +i.4))

NB. Execution is pre-assigned to threadpools. Intermediate results are
locked from a calling tabulation task.
NB. The Final tabulation task executes when each pool has signaled that all
of its assigned tasks are complete.

] Exec_sched_form2 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
)),(notional_work_list) ,."2 (,.<"_1(1),(2),(3),(4),(_),(_),(_),(_),(_),(_))

NB. Threadpools are initialized with an execution task (passed a task). By
Thread configuration, on completion of
NB. an execution, the worker checks for remaining tasks (from the
Work_List). If there are no remaining tasks, the pool destroyed.
NB. If there are remaining tasks, the task is locked and executed by the
worker. This series repeats to completion.
NB. When signaled the final tablution task is executed.


On Thu., Jan. 5, 2023, 03:40 Ak O,  wrote:

>
>
> NB. Simulated long running tasks, of variable execution length.
>
> ] wrk_prcs =: ([: < (1 ? [) A. ([: i. ]))"0 0
>
> ] x=. 90 31 235 77 83 99 17 62 122 23
> ] y=. 12 4 _17 8 5 _8 9 6 15 _4
>
> NB. The solution pyx look like this:
>
>   (x wrk_prcs y)
>
> ] notional_work_list =: ,.<;._1
> ',(<(1?90)A.(i.12)),(<(1?31)A.(i.4)),(<(1?235)A.(i._17)),(<(1?77)A.(i.8)),(<(1?83)A.(i.5)),(<(1?99)A.(i._8)),(<(1?17)A.(i.9)),(<(1?62)A.(i.6)),(<(1?122)A.(i.15)),(<(1?23)A.(i._4))
> '
>
>
> ] Exec_sched_form1 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
> )),(notional_work_list) ,."2 (,.10 $ <"_1 ( 1 +i.4))
>
> NB. Execution is pre-assigned to threadpools. Intermediate results are
> locked from a calling tabulation task.
> NB. The Final tabulation task executes when each pool has signaled that
> all of its assigned tasks are complete.
>
>
> ] Exec_sched_form2 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
> )),(notional_work_list) ,."2
> (,.<"_1(1),(2),(3),(4),(_),(_),(_),(_),(_),(_))
>
> NB. Threadpools are initialized with an execution task (passed a task). By
> Thread configuration, on completion of
> NB. an execution, the worker checks for remaining tasks (from the
> Work_List). If there are no remaining tasks, the pool destroyed.
> NB. If there are remaining tasks, the task is locked and executed by the
> worker. This series repeats to completion.
> NB. When signaled the final tablution task is executed.
>
>
>
> Ak
>
>
> On Wed., Jan. 4, 2023, 22:14 Raul Miller,  wrote:
>
>> It's also worth noting that threads do not spin down immediately --
>> they only spin down when they're idle.
>>
>> And, as you have noted it's basically a stack of threads.
>>
>> So what you'd have to do is spin down as many threads as necessary to
>> eliminate the thread you wish to eliminate and then spin back up the
>> threads which you wish to remain.
>>
>> Or, shut down J completely and initialize a new instance of J with
>> your desired thread pool structure.
>>
>> (That said... why would you want to restructure your thread pools like
>> this?)
>>
>> --
>> Raul
>>
>> On Wed, Jan 4, 2023 at 8:33 PM Ak O  wrote:
>> >
>> > In a case where,
>> >  {{0 T. 2}}''
>> >  {{0 T. 4}}''
>> >  {{0 T. 7}}''
>> >
>> > How do I spin down the thread in pool number 4?
>> >
>> > I think operation,
>> >  {{55 T. ''}}
>> > spins down only the most recently created thread.
>> >
>> >
>> > Thank you Henry.
>> >
>> > Ak
>> >
>> >
>> >
>> > On Wed., Jan. 4, 2023, 16:29 Henry Rich,  wrote:
>> >
>> > > Yes, that's right.
>> > >
>> > > Henry
>> > > On 1/4/
>> >
>> > Rich
>> >
>> > 2023 6:11 PM, Ak O wrote:
>> > > > Happy New Year,
>> > > >
>> > > > I hope you are all well.
>> > > >
>> > > > I am still struggling, please continue to have patience with me.
>> > > >
>> > > >
>> > > > Where,
>> > > >   {{0 T. ''}}''
>> > > > creates a new thread.
>> > > >
>> > > > Does this,
>> > > >   {{0 T. 7}}''
>> > > > create a new thread in pool number 7? Or how is this function
>> treated?
>> > > >
>> > > > Thank you,
>> > > >
>> > > > Ak
>> > > >
>> --
>> > > > For information about J forums see
>> http://www.jsoftware.com/forums.htm
>> > >
>> > > --
>> > > For information about J forums see
>> http://www.jsoftware.com/forums.htm
>> > >
>> > 

Re: [Jprogramming] Thread Primitives -> Configuration 0 T.'' (T.)

2023-01-05 Thread Henry Rich
You can't.  You can delete only the most-recently-created thread.  This 
is a deficiency but we decided to wait on fixing it until there is a 
demonstrated need.


Henry Rich

On 1/4/2023 8:32 PM, Ak O wrote:

In a case where,
  {{0 T. 2}}''
  {{0 T. 4}}''
  {{0 T. 7}}''

How do I spin down the thread in pool number 4?

I think operation,
  {{55 T. ''}}
spins down only the most recently created thread.


Thank you Henry.

Ak



On Wed., Jan. 4, 2023, 16:29 Henry Rich,  wrote:


Yes, that's right.

Henry
On 1/4/

Rich

2023 6:11 PM, Ak O wrote:

Happy New Year,

I hope you are all well.

I am still struggling, please continue to have patience with me.


Where,
   {{0 T. ''}}''
creates a new thread.

Does this,
   {{0 T. 7}}''
create a new thread in pool number 7? Or how is this function treated?

Thank you,

Ak
--
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


Re: [Jprogramming] Thread Primitives -> Configuration 0 T.'' (T.)

2023-01-05 Thread Ak O
NB. Simulated long running tasks, of variable execution length.

] wrk_prcs =: ([: < (1 ? [) A. ([: i. ]))"0 0

] x=. 90 31 235 77 83 99 17 62 122 23
] y=. 12 4 _17 8 5 _8 9 6 15 _4

NB. The solution pyx look like this:

  (x wrk_prcs y)

] notional_work_list =: ,.<;._1
',(<(1?90)A.(i.12)),(<(1?31)A.(i.4)),(<(1?235)A.(i._17)),(<(1?77)A.(i.8)),(<(1?83)A.(i.5)),(<(1?99)A.(i._8)),(<(1?17)A.(i.9)),(<(1?62)A.(i.6)),(<(1?122)A.(i.15)),(<(1?23)A.(i._4))
'


] Exec_sched_form1 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
)),(notional_work_list) ,."2 (,.10 $ <"_1 ( 1 +i.4))

NB. Execution is pre-assigned to threadpools. Intermediate results are
locked from a calling tabulation task.
NB. The Final tabulation task executes when each pool has signaled that all
of its assigned tasks are complete.


] Exec_sched_form2 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
)),(notional_work_list) ,."2
(,.<"_1(1),(2),(3),(4),(_),(_),(_),(_),(_),(_))

NB. Threadpools are initialized with an execution task (passed a task). By
Thread configuration, on completion of
NB. an execution, the worker checks for remaining tasks (from the
Work_List). If there are no remaining tasks, the pool destroyed.
NB. If there are remaining tasks, the task is locked and executed by the
worker. This series repeats to completion.
NB. When signaled the final tablution task is executed.



Ak


On Wed., Jan. 4, 2023, 22:14 Raul Miller,  wrote:

> It's also worth noting that threads do not spin down immediately --
> they only spin down when they're idle.
>
> And, as you have noted it's basically a stack of threads.
>
> So what you'd have to do is spin down as many threads as necessary to
> eliminate the thread you wish to eliminate and then spin back up the
> threads which you wish to remain.
>
> Or, shut down J completely and initialize a new instance of J with
> your desired thread pool structure.
>
> (That said... why would you want to restructure your thread pools like
> this?)
>
> --
> Raul
>
> On Wed, Jan 4, 2023 at 8:33 PM Ak O  wrote:
> >
> > In a case where,
> >  {{0 T. 2}}''
> >  {{0 T. 4}}''
> >  {{0 T. 7}}''
> >
> > How do I spin down the thread in pool number 4?
> >
> > I think operation,
> >  {{55 T. ''}}
> > spins down only the most recently created thread.
> >
> >
> > Thank you Henry.
> >
> > Ak
> >
> >
> >
> > On Wed., Jan. 4, 2023, 16:29 Henry Rich,  wrote:
> >
> > > Yes, that's right.
> > >
> > > Henry
> > > On 1/4/
> >
> > Rich
> >
> > 2023 6:11 PM, Ak O wrote:
> > > > Happy New Year,
> > > >
> > > > I hope you are all well.
> > > >
> > > > I am still struggling, please continue to have patience with me.
> > > >
> > > >
> > > > Where,
> > > >   {{0 T. ''}}''
> > > > creates a new thread.
> > > >
> > > > Does this,
> > > >   {{0 T. 7}}''
> > > > create a new thread in pool number 7? Or how is this function
> treated?
> > > >
> > > > Thank you,
> > > >
> > > > Ak
> > > >
> --
> > > > 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


Re: [Jprogramming] Thread Primitives -> Configuration 0 T.'' (T.)

2023-01-04 Thread Raul Miller
It's also worth noting that threads do not spin down immediately --
they only spin down when they're idle.

And, as you have noted it's basically a stack of threads.

So what you'd have to do is spin down as many threads as necessary to
eliminate the thread you wish to eliminate and then spin back up the
threads which you wish to remain.

Or, shut down J completely and initialize a new instance of J with
your desired thread pool structure.

(That said... why would you want to restructure your thread pools like this?)

-- 
Raul

On Wed, Jan 4, 2023 at 8:33 PM Ak O  wrote:
>
> In a case where,
>  {{0 T. 2}}''
>  {{0 T. 4}}''
>  {{0 T. 7}}''
>
> How do I spin down the thread in pool number 4?
>
> I think operation,
>  {{55 T. ''}}
> spins down only the most recently created thread.
>
>
> Thank you Henry.
>
> Ak
>
>
>
> On Wed., Jan. 4, 2023, 16:29 Henry Rich,  wrote:
>
> > Yes, that's right.
> >
> > Henry
> > On 1/4/
>
> Rich
>
> 2023 6:11 PM, Ak O wrote:
> > > Happy New Year,
> > >
> > > I hope you are all well.
> > >
> > > I am still struggling, please continue to have patience with me.
> > >
> > >
> > > Where,
> > >   {{0 T. ''}}''
> > > creates a new thread.
> > >
> > > Does this,
> > >   {{0 T. 7}}''
> > > create a new thread in pool number 7? Or how is this function treated?
> > >
> > > Thank you,
> > >
> > > Ak
> > > --
> > > 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


[Jprogramming] Thread Primitives -> Configuration 0 T.'' (T.)

2023-01-04 Thread Ak O
In a case where,
 {{0 T. 2}}''
 {{0 T. 4}}''
 {{0 T. 7}}''

How do I spin down the thread in pool number 4?

I think operation,
 {{55 T. ''}}
spins down only the most recently created thread.


Thank you Henry.

Ak



On Wed., Jan. 4, 2023, 16:29 Henry Rich,  wrote:

> Yes, that's right.
>
> Henry
> On 1/4/

Rich

2023 6:11 PM, Ak O wrote:
> > Happy New Year,
> >
> > I hope you are all well.
> >
> > I am still struggling, please continue to have patience with me.
> >
> >
> > Where,
> >   {{0 T. ''}}''
> > creates a new thread.
> >
> > Does this,
> >   {{0 T. 7}}''
> > create a new thread in pool number 7? Or how is this function treated?
> >
> > Thank you,
> >
> > Ak
> > --
> > 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


Re: [Jprogramming] Thread Primitives -> Configuration 0 T.'' (T.)

2023-01-04 Thread Henry Rich

Yes, that's right.

Henry Rich

On 1/4/2023 6:11 PM, Ak O wrote:

Happy New Year,

I hope you are all well.

I am still struggling, please continue to have patience with me.


Where,
  {{0 T. ''}}''
creates a new thread.

Does this,
  {{0 T. 7}}''
create a new thread in pool number 7? Or how is this function treated?

Thank you,

Ak
--
For information about J forums see http://www.jsoftware.com/forums.htm


--
For information about J forums see http://www.jsoftware.com/forums.htm


[Jprogramming] Thread Primitives -> Configuration 0 T.'' (T.)

2023-01-04 Thread Ak O
Happy New Year,

I hope you are all well.

I am still struggling, please continue to have patience with me.


Where,
 {{0 T. ''}}''
creates a new thread.

Does this,
 {{0 T. 7}}''
create a new thread in pool number 7? Or how is this function treated?

Thank you,

Ak
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] can i trust `:0 to always execute left to right?

2021-09-30 Thread 'Pascal Jasmin' via Programming
can build from gerund

 ntG =: (,'0')&;(<@:)
seq =: {{}. , (ntG n),~"_ 1 u ,~"0 1 [`'' }}(`:6)

+`-`* seq 3

3


 +`-`* {{}. , (ntG n),~"_ 1 u ,~"0 1 [`'' }} 3

┌─┬─┬─┬─┬─┬─┬─┬─┐

│+│┌─┬─┐│[│-│┌─┬─┐│[│*│┌─┬─┐│

│ ││0│3││ │ ││0│3││ │ ││0│3││

│ │└─┴─┘│ │ │└─┴─┘│ │ │└─┴─┘│

└─┴─┴─┴─┴─┴─┴─┴─┘

is right to left, but reversing u would be left to right.






On Thursday, September 30, 2021, 02:42:44 p.m. EDT, Michal Wallace 
 wrote: 





That is unfortunate.  Normally, I am perfectly comfortable with [ and @
to do function composition, but sometimes I really wish to convey the idea
of a sequence,
and it just doesn't feel like the same thing as function composition to me.

(So I prefer newlines to [ or @ in these situations, but then that wastes
vertical space...)

How would you feel about  introducing, say,
`:_1 (and perhaps `:1 ) that guaranteed a left-to-right (and right-to-left)
order, explicitly?

`:1 would just be  (|.m)`:_1
`:1 would just be an alias for the current implementation,
which would not change alongside `:0 if `:0 changes in the future.



On Thu, Sep 30, 2021 at 2:32 PM Henry Rich  wrote:

> You cannot count on the order.  All you know is that each cell of the
> result corresponds to an AR in the gerund.
>
> To execute short sentences the usage
>
> sentencen [ ... [ sentence2 [ sentence1
>
> can't be beat unless one of the sentences produces a modifier.
>
> Henry Rich
>
> On 9/30/2021 2:15 PM, Michal Wallace wrote:
> > Today I discovered that `:0 executes the gerund in series from left to
> > right.
> >
> > The execution order isn't specified in the docs (as far as I can tell),
> so
> > I wonder if it's an implementation detail subject to change, or if I can
> > rely on this?
> >
> > Almost all of the cases where I want '..' as a statement handler have
> > to do with executing small imperative niladic instructions in sequence,
> > and it seems like `:0'' handles that perfectly:
> >
> >    NB. after loading tangentstorm/j-kvm/vt:
> >    (bg@16b22)`(fg@_15)`cscr`(goxy@5 5)`(puts@('hello',CRLF))`:0''
> >
> > (set the colors, clear the screen, go to position 5,5 and emit 'hello'...
> > in that order!)
> >
> > So... Can I count on this execution order?
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
>
> --
> This email has been checked for viruses by AVG.
> https://www.avg.com

>
> --
> 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


Re: [Jprogramming] can i trust `:0 to always execute left to right?

2021-09-30 Thread Elijah Stone

On Thu, 30 Sep 2021, Elijah Stone wrote:


(For that to work, you need to write it as {{ ((,[`'',])/ |.m) `: 6 }}, without 
mention of y.)


Another good reason to write it that way: the resultant verb is ambivalent.
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] can i trust `:0 to always execute left to right?

2021-09-30 Thread Elijah Stone

On Thu, 30 Sep 2021, Hauke Rehr wrote:


I think Michal wants the adverb variant


In the original code snippet, the argument was '', so I assumed it didn't 
matter.  Actually, I originally wrote it as an adverb, then realised it 
could be written more directly as a verb.


However, it occurs to me that there's another good reason to make it an 
adverb: it executes in the caller's namespace.  (For that to work, you 
need to write it as {{ ((,[`'',])/ |.m) `: 6 }}, without mention of y.)


 -E
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] can i trust `:0 to always execute left to right?

2021-09-30 Thread Hauke Rehr

I forgot: it doesn’t /need/ to be an adverb:
replace m by x, and you’ll get the same functionality
with type 'seeq' returning <'verb' but I think
adverb better fits the purpose.

Am 30.09.21 um 23:59 schrieb Hauke Rehr:

I think Michal wants the adverb variant

seeq =. {{ ((,[`'',])/ |.m) `: 6 y}}
so
    {{echo |. 'sinu',y}}`{{echo ,~y}}`{{echo y}} seeq 'state'
etatsunis
statestate
state


which obviously only works if his State object
will not be changed by any but the last part.
But when you have state, you want it to change.
So an explicit verb should be better here imo.


Am 30.09.21 um 23:15 schrieb Elijah Stone:

Why not define it yourself?

    seq =. {{ ((,[`'',])/ |.y) `: 6 ''}}
    seq {{echo 1}}`{{echo 2}}`{{echo 3}}
1
2
3

  -E

On Thu, 30 Sep 2021, Michal Wallace wrote:


Today I discovered that `:0 executes the gerund in series from left to
right.

The execution order isn't specified in the docs (as far as I can 
tell), so

I wonder if it's an implementation detail subject to change, or if I can
rely on this?

Almost all of the cases where I want '..' as a statement handler have
to do with executing small imperative niladic instructions in sequence,
and it seems like `:0'' handles that perfectly:

 NB. after loading tangentstorm/j-kvm/vt:
 (bg@16b22)`(fg@_15)`cscr`(goxy@5 5)`(puts@('hello',CRLF))`:0''

(set the colors, clear the screen, go to position 5,5 and emit 
'hello'...

in that order!)

So... Can I count on this execution order?
--
For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm




--
--
mail written using NEO
neo-layout.org

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] can i trust `:0 to always execute left to right?

2021-09-30 Thread Hauke Rehr

I think Michal wants the adverb variant

seeq =. {{ ((,[`'',])/ |.m) `: 6 y}}
so
   {{echo |. 'sinu',y}}`{{echo ,~y}}`{{echo y}} seeq 'state'
etatsunis
statestate
state


which obviously only works if his State object
will not be changed by any but the last part.
But when you have state, you want it to change.
So an explicit verb should be better here imo.


Am 30.09.21 um 23:15 schrieb Elijah Stone:

Why not define it yourself?

    seq =. {{ ((,[`'',])/ |.y) `: 6 ''}}
    seq {{echo 1}}`{{echo 2}}`{{echo 3}}
1
2
3

  -E

On Thu, 30 Sep 2021, Michal Wallace wrote:


Today I discovered that `:0 executes the gerund in series from left to
right.

The execution order isn't specified in the docs (as far as I can 
tell), so

I wonder if it's an implementation detail subject to change, or if I can
rely on this?

Almost all of the cases where I want '..' as a statement handler have
to do with executing small imperative niladic instructions in sequence,
and it seems like `:0'' handles that perfectly:

 NB. after loading tangentstorm/j-kvm/vt:
 (bg@16b22)`(fg@_15)`cscr`(goxy@5 5)`(puts@('hello',CRLF))`:0''

(set the colors, clear the screen, go to position 5,5 and emit 'hello'...
in that order!)

So... Can I count on this execution order?
--
For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


--
--
mail written using NEO
neo-layout.org

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] can i trust `:0 to always execute left to right?

2021-09-30 Thread Elijah Stone

Why not define it yourself?

   seq =. {{ ((,[`'',])/ |.y) `: 6 ''}}
   seq {{echo 1}}`{{echo 2}}`{{echo 3}}
1
2
3

 -E

On Thu, 30 Sep 2021, Michal Wallace wrote:


Today I discovered that `:0 executes the gerund in series from left to
right.

The execution order isn't specified in the docs (as far as I can tell), so
I wonder if it's an implementation detail subject to change, or if I can
rely on this?

Almost all of the cases where I want '..' as a statement handler have
to do with executing small imperative niladic instructions in sequence,
and it seems like `:0'' handles that perfectly:

 NB. after loading tangentstorm/j-kvm/vt:
 (bg@16b22)`(fg@_15)`cscr`(goxy@5 5)`(puts@('hello',CRLF))`:0''

(set the colors, clear the screen, go to position 5,5 and emit 'hello'...
in that order!)

So... Can I count on this execution order?
--
For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] can i trust `:0 to always execute left to right?

2021-09-30 Thread Henry Rich
Gee, guys, I wasn't saying I would remove `:0, or even that I wanted 
to.  The language doesn't belong to me.  We only make incompatible 
changes when we realize something should never have been implemented or 
was wrongly implemented.


It's nice to know there are applications for `:0 .  A suitable such 
application would need to have inputs AND OUTPUTs defined to a common 
template.


That's why I don't think it's a good choice for simply sequencing the 
dissimilar operations that Michal mentioned in his first post.  [ does that.


Henry Rich

On 9/30/2021 3:36 PM, Raoul Schorer wrote:

I'm not a pro developer in any way, but my job entails some data analysis.
Executing multiple verbs on the same data is something I do whenever I'm
extracting distinct feature vectors or summary stats from raw data.
Also, same thing when working on trees Hsu-style. I'd be sad to see :0 go!

Just my 2c.

Cheers,
Raoul

Le jeu. 30 sept. 2021 à 21:25, Michal Wallace  a
écrit :


Huh. That's a strange thought to me.

I execute a bunch of verbs on the same arguments **all the time**,
especially when I'm working with input/output or mutable data:

- parser combinators
- virtual machines
- terminal i/o

Usually the argument in question is the empty string or some kind of state
object.

If I'm composing parsers to match your name, I want to write something
like:

(match@'Henry')`(match@'Rich')

not:

(match@'Rich') @ (match@'Henry')

Sure, the latter works, but it's silly, and gets progressively worse as the
size of the language grows.

Sometimes the natural way to express things is left to right.
J doesn't make you write strings or numeric arrays backwards.

Thankfully, now that I have my answer,  I can just use:

   run =:`:0

... and then redefine 'run' in the future if `:0 ever gets removed. :)


On Thu, Sep 30, 2021 at 3:00 PM Henry Rich  wrote:


I would vote to delete u`:0 rather than extend it.  Executing a bunch of
verbs on the same arguments?  Not a very useful thing I think.

Using [ to separate executions is The J Way.  Very efficient. Train
yourself to get used to it.

Newlines are even better.  Then you can put a comment on each line.

Henry Rich

On 9/30/2021 2:42 PM, Michal Wallace wrote:

That is unfortunate.   Normally, I am perfectly comfortable with [ and

@

to do function composition, but sometimes I really wish to convey the

idea

of a sequence,
and it just doesn't feel like the same thing as function composition to

me.

(So I prefer newlines to [ or @ in these situations, but then that

wastes

vertical space...)

How would you feel about  introducing, say,
`:_1 (and perhaps `:1 ) that guaranteed a left-to-right (and

right-to-left)

order, explicitly?

`:1 would just be   (|.m)`:_1
`:1 would just be an alias for the current implementation,
which would not change alongside `:0 if `:0 changes in the future.



On Thu, Sep 30, 2021 at 2:32 PM Henry Rich 

wrote:

You cannot count on the order.  All you know is that each cell of the
result corresponds to an AR in the gerund.

To execute short sentences the usage

sentencen [ ... [ sentence2 [ sentence1

can't be beat unless one of the sentences produces a modifier.

Henry Rich

On 9/30/2021 2:15 PM, Michal Wallace wrote:

Today I discovered that `:0 executes the gerund in series from left

to

right.

The execution order isn't specified in the docs (as far as I can

tell),

so

I wonder if it's an implementation detail subject to change, or if I

can

rely on this?

Almost all of the cases where I want '..' as a statement handler have
to do with executing small imperative niladic instructions in

sequence,

and it seems like `:0'' handles that perfectly:

 NB. after loading tangentstorm/j-kvm/vt:
 (bg@16b22)`(fg@_15)`cscr`(goxy@5 5)`(puts@

('hello',CRLF))`:0''

(set the colors, clear the screen, go to position 5,5 and emit

'hello'...

in that order!)

So... Can I count on this execution order?


--

For information about J forums see

http://www.jsoftware.com/forums.htm

--
This email has been checked for viruses by AVG.
https://www.avg.com

--
For information about J forums see

http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


--
This email has been checked for viruses by AVG.
https://www.avg.com

--
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



--
This email has been checked for viruses by AVG.

Re: [Jprogramming] can i trust `:0 to always execute left to right?

2021-09-30 Thread Raoul Schorer
I'm not a pro developer in any way, but my job entails some data analysis.
Executing multiple verbs on the same data is something I do whenever I'm
extracting distinct feature vectors or summary stats from raw data.
Also, same thing when working on trees Hsu-style. I'd be sad to see :0 go!

Just my 2c.

Cheers,
Raoul

Le jeu. 30 sept. 2021 à 21:25, Michal Wallace  a
écrit :

> Huh. That's a strange thought to me.
>
> I execute a bunch of verbs on the same arguments **all the time**,
> especially when I'm working with input/output or mutable data:
>
> - parser combinators
> - virtual machines
> - terminal i/o
>
> Usually the argument in question is the empty string or some kind of state
> object.
>
> If I'm composing parsers to match your name, I want to write something
> like:
>
> (match@'Henry')`(match@'Rich')
>
> not:
>
> (match@'Rich') @ (match@'Henry')
>
> Sure, the latter works, but it's silly, and gets progressively worse as the
> size of the language grows.
>
> Sometimes the natural way to express things is left to right.
> J doesn't make you write strings or numeric arrays backwards.
>
> Thankfully, now that I have my answer,  I can just use:
>
>   run =:`:0
>
> ... and then redefine 'run' in the future if `:0 ever gets removed. :)
>
>
> On Thu, Sep 30, 2021 at 3:00 PM Henry Rich  wrote:
>
> > I would vote to delete u`:0 rather than extend it.  Executing a bunch of
> > verbs on the same arguments?  Not a very useful thing I think.
> >
> > Using [ to separate executions is The J Way.  Very efficient. Train
> > yourself to get used to it.
> >
> > Newlines are even better.  Then you can put a comment on each line.
> >
> > Henry Rich
> >
> > On 9/30/2021 2:42 PM, Michal Wallace wrote:
> > > That is unfortunate.   Normally, I am perfectly comfortable with [ and
> @
> > > to do function composition, but sometimes I really wish to convey the
> > idea
> > > of a sequence,
> > > and it just doesn't feel like the same thing as function composition to
> > me.
> > >
> > > (So I prefer newlines to [ or @ in these situations, but then that
> wastes
> > > vertical space...)
> > >
> > > How would you feel about  introducing, say,
> > > `:_1 (and perhaps `:1 ) that guaranteed a left-to-right (and
> > right-to-left)
> > > order, explicitly?
> > >
> > > `:1 would just be   (|.m)`:_1
> > > `:1 would just be an alias for the current implementation,
> > > which would not change alongside `:0 if `:0 changes in the future.
> > >
> > >
> > >
> > > On Thu, Sep 30, 2021 at 2:32 PM Henry Rich 
> wrote:
> > >
> > >> You cannot count on the order.  All you know is that each cell of the
> > >> result corresponds to an AR in the gerund.
> > >>
> > >> To execute short sentences the usage
> > >>
> > >> sentencen [ ... [ sentence2 [ sentence1
> > >>
> > >> can't be beat unless one of the sentences produces a modifier.
> > >>
> > >> Henry Rich
> > >>
> > >> On 9/30/2021 2:15 PM, Michal Wallace wrote:
> > >>> Today I discovered that `:0 executes the gerund in series from left
> to
> > >>> right.
> > >>>
> > >>> The execution order isn't specified in the docs (as far as I can
> tell),
> > >> so
> > >>> I wonder if it's an implementation detail subject to change, or if I
> > can
> > >>> rely on this?
> > >>>
> > >>> Almost all of the cases where I want '..' as a statement handler have
> > >>> to do with executing small imperative niladic instructions in
> sequence,
> > >>> and it seems like `:0'' handles that perfectly:
> > >>>
> > >>> NB. after loading tangentstorm/j-kvm/vt:
> > >>> (bg@16b22)`(fg@_15)`cscr`(goxy@5 5)`(puts@
> ('hello',CRLF))`:0''
> > >>>
> > >>> (set the colors, clear the screen, go to position 5,5 and emit
> > 'hello'...
> > >>> in that order!)
> > >>>
> > >>> So... Can I count on this execution order?
> > >>>
> --
> > >>> For information about J forums see
> http://www.jsoftware.com/forums.htm
> > >>
> > >> --
> > >> This email has been checked for viruses by AVG.
> > >> https://www.avg.com
> > >>
> > >> --
> > >> For information about J forums see
> http://www.jsoftware.com/forums.htm
> > >>
> > > --
> > > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> >
> > --
> > This email has been checked for viruses by AVG.
> > https://www.avg.com
> >
> > --
> > 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


Re: [Jprogramming] can i trust `:0 to always execute left to right?

2021-09-30 Thread Michal Wallace
Huh. That's a strange thought to me.

I execute a bunch of verbs on the same arguments **all the time**,
especially when I'm working with input/output or mutable data:

- parser combinators
- virtual machines
- terminal i/o

Usually the argument in question is the empty string or some kind of state
object.

If I'm composing parsers to match your name, I want to write something like:

(match@'Henry')`(match@'Rich')

not:

(match@'Rich') @ (match@'Henry')

Sure, the latter works, but it's silly, and gets progressively worse as the
size of the language grows.

Sometimes the natural way to express things is left to right.
J doesn't make you write strings or numeric arrays backwards.

Thankfully, now that I have my answer,  I can just use:

  run =:`:0

... and then redefine 'run' in the future if `:0 ever gets removed. :)


On Thu, Sep 30, 2021 at 3:00 PM Henry Rich  wrote:

> I would vote to delete u`:0 rather than extend it.  Executing a bunch of
> verbs on the same arguments?  Not a very useful thing I think.
>
> Using [ to separate executions is The J Way.  Very efficient. Train
> yourself to get used to it.
>
> Newlines are even better.  Then you can put a comment on each line.
>
> Henry Rich
>
> On 9/30/2021 2:42 PM, Michal Wallace wrote:
> > That is unfortunate.   Normally, I am perfectly comfortable with [ and @
> > to do function composition, but sometimes I really wish to convey the
> idea
> > of a sequence,
> > and it just doesn't feel like the same thing as function composition to
> me.
> >
> > (So I prefer newlines to [ or @ in these situations, but then that wastes
> > vertical space...)
> >
> > How would you feel about  introducing, say,
> > `:_1 (and perhaps `:1 ) that guaranteed a left-to-right (and
> right-to-left)
> > order, explicitly?
> >
> > `:1 would just be   (|.m)`:_1
> > `:1 would just be an alias for the current implementation,
> > which would not change alongside `:0 if `:0 changes in the future.
> >
> >
> >
> > On Thu, Sep 30, 2021 at 2:32 PM Henry Rich  wrote:
> >
> >> You cannot count on the order.  All you know is that each cell of the
> >> result corresponds to an AR in the gerund.
> >>
> >> To execute short sentences the usage
> >>
> >> sentencen [ ... [ sentence2 [ sentence1
> >>
> >> can't be beat unless one of the sentences produces a modifier.
> >>
> >> Henry Rich
> >>
> >> On 9/30/2021 2:15 PM, Michal Wallace wrote:
> >>> Today I discovered that `:0 executes the gerund in series from left to
> >>> right.
> >>>
> >>> The execution order isn't specified in the docs (as far as I can tell),
> >> so
> >>> I wonder if it's an implementation detail subject to change, or if I
> can
> >>> rely on this?
> >>>
> >>> Almost all of the cases where I want '..' as a statement handler have
> >>> to do with executing small imperative niladic instructions in sequence,
> >>> and it seems like `:0'' handles that perfectly:
> >>>
> >>> NB. after loading tangentstorm/j-kvm/vt:
> >>> (bg@16b22)`(fg@_15)`cscr`(goxy@5 5)`(puts@('hello',CRLF))`:0''
> >>>
> >>> (set the colors, clear the screen, go to position 5,5 and emit
> 'hello'...
> >>> in that order!)
> >>>
> >>> So... Can I count on this execution order?
> >>> --
> >>> For information about J forums see http://www.jsoftware.com/forums.htm
> >>
> >> --
> >> This email has been checked for viruses by AVG.
> >> https://www.avg.com
> >>
> >> --
> >> For information about J forums see http://www.jsoftware.com/forums.htm
> >>
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
>
> --
> This email has been checked for viruses by AVG.
> https://www.avg.com
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] can i trust `:0 to always execute left to right?

2021-09-30 Thread Henry Rich
I would vote to delete u`:0 rather than extend it.  Executing a bunch of 
verbs on the same arguments?  Not a very useful thing I think.


Using [ to separate executions is The J Way.  Very efficient. Train 
yourself to get used to it.


Newlines are even better.  Then you can put a comment on each line.

Henry Rich

On 9/30/2021 2:42 PM, Michal Wallace wrote:

That is unfortunate.   Normally, I am perfectly comfortable with [ and @
to do function composition, but sometimes I really wish to convey the idea
of a sequence,
and it just doesn't feel like the same thing as function composition to me.

(So I prefer newlines to [ or @ in these situations, but then that wastes
vertical space...)

How would you feel about  introducing, say,
`:_1 (and perhaps `:1 ) that guaranteed a left-to-right (and right-to-left)
order, explicitly?

`:1 would just be   (|.m)`:_1
`:1 would just be an alias for the current implementation,
which would not change alongside `:0 if `:0 changes in the future.



On Thu, Sep 30, 2021 at 2:32 PM Henry Rich  wrote:


You cannot count on the order.  All you know is that each cell of the
result corresponds to an AR in the gerund.

To execute short sentences the usage

sentencen [ ... [ sentence2 [ sentence1

can't be beat unless one of the sentences produces a modifier.

Henry Rich

On 9/30/2021 2:15 PM, Michal Wallace wrote:

Today I discovered that `:0 executes the gerund in series from left to
right.

The execution order isn't specified in the docs (as far as I can tell),

so

I wonder if it's an implementation detail subject to change, or if I can
rely on this?

Almost all of the cases where I want '..' as a statement handler have
to do with executing small imperative niladic instructions in sequence,
and it seems like `:0'' handles that perfectly:

NB. after loading tangentstorm/j-kvm/vt:
(bg@16b22)`(fg@_15)`cscr`(goxy@5 5)`(puts@('hello',CRLF))`:0''

(set the colors, clear the screen, go to position 5,5 and emit 'hello'...
in that order!)

So... Can I count on this execution order?
--
For information about J forums see http://www.jsoftware.com/forums.htm


--
This email has been checked for viruses by AVG.
https://www.avg.com

--
For information about J forums see http://www.jsoftware.com/forums.htm


--
For information about J forums see http://www.jsoftware.com/forums.htm



--
This email has been checked for viruses by AVG.
https://www.avg.com

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] can i trust `:0 to always execute left to right?

2021-09-30 Thread Michal Wallace
That is unfortunate.   Normally, I am perfectly comfortable with [ and @
to do function composition, but sometimes I really wish to convey the idea
of a sequence,
and it just doesn't feel like the same thing as function composition to me.

(So I prefer newlines to [ or @ in these situations, but then that wastes
vertical space...)

How would you feel about  introducing, say,
`:_1 (and perhaps `:1 ) that guaranteed a left-to-right (and right-to-left)
order, explicitly?

`:1 would just be   (|.m)`:_1
`:1 would just be an alias for the current implementation,
which would not change alongside `:0 if `:0 changes in the future.



On Thu, Sep 30, 2021 at 2:32 PM Henry Rich  wrote:

> You cannot count on the order.  All you know is that each cell of the
> result corresponds to an AR in the gerund.
>
> To execute short sentences the usage
>
> sentencen [ ... [ sentence2 [ sentence1
>
> can't be beat unless one of the sentences produces a modifier.
>
> Henry Rich
>
> On 9/30/2021 2:15 PM, Michal Wallace wrote:
> > Today I discovered that `:0 executes the gerund in series from left to
> > right.
> >
> > The execution order isn't specified in the docs (as far as I can tell),
> so
> > I wonder if it's an implementation detail subject to change, or if I can
> > rely on this?
> >
> > Almost all of the cases where I want '..' as a statement handler have
> > to do with executing small imperative niladic instructions in sequence,
> > and it seems like `:0'' handles that perfectly:
> >
> >NB. after loading tangentstorm/j-kvm/vt:
> >(bg@16b22)`(fg@_15)`cscr`(goxy@5 5)`(puts@('hello',CRLF))`:0''
> >
> > (set the colors, clear the screen, go to position 5,5 and emit 'hello'...
> > in that order!)
> >
> > So... Can I count on this execution order?
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
>
> --
> This email has been checked for viruses by AVG.
> https://www.avg.com
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] can i trust `:0 to always execute left to right?

2021-09-30 Thread Henry Rich
You cannot count on the order.  All you know is that each cell of the 
result corresponds to an AR in the gerund.


To execute short sentences the usage

sentencen [ ... [ sentence2 [ sentence1

can't be beat unless one of the sentences produces a modifier.

Henry Rich

On 9/30/2021 2:15 PM, Michal Wallace wrote:

Today I discovered that `:0 executes the gerund in series from left to
right.

The execution order isn't specified in the docs (as far as I can tell), so
I wonder if it's an implementation detail subject to change, or if I can
rely on this?

Almost all of the cases where I want '..' as a statement handler have
to do with executing small imperative niladic instructions in sequence,
and it seems like `:0'' handles that perfectly:

   NB. after loading tangentstorm/j-kvm/vt:
   (bg@16b22)`(fg@_15)`cscr`(goxy@5 5)`(puts@('hello',CRLF))`:0''

(set the colors, clear the screen, go to position 5,5 and emit 'hello'...
in that order!)

So... Can I count on this execution order?
--
For information about J forums see http://www.jsoftware.com/forums.htm



--
This email has been checked for viruses by AVG.
https://www.avg.com

--
For information about J forums see http://www.jsoftware.com/forums.htm


[Jprogramming] can i trust `:0 to always execute left to right?

2021-09-30 Thread Michal Wallace
Today I discovered that `:0 executes the gerund in series from left to
right.

The execution order isn't specified in the docs (as far as I can tell), so
I wonder if it's an implementation detail subject to change, or if I can
rely on this?

Almost all of the cases where I want '..' as a statement handler have
to do with executing small imperative niladic instructions in sequence,
and it seems like `:0'' handles that perfectly:

  NB. after loading tangentstorm/j-kvm/vt:
  (bg@16b22)`(fg@_15)`cscr`(goxy@5 5)`(puts@('hello',CRLF))`:0''

(set the colors, clear the screen, go to position 5,5 and emit 'hello'...
in that order!)

So... Can I count on this execution order?
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Show cause hearing: +"0 will be +

2021-01-23 Thread Henry Rich
OK, I'll look at tte, but I am highly confident that replacing u"n with 
u (when n = the ranks of u) will not affect anything other than display 
and special code.  You would see


   plus =: +"0
   plus
+

which is in itself instructive.

Henry Rich

On 1/23/2021 7:53 PM, Ian Clark wrote:

As a career-beginner, most of the time I wouldn't notice. But I take it
this proposal would apply to verbs created from explicitly defined
modifiers too, not just primitives like (+)?

Is the (de)activation of special code the *only* side-effect? Can you think
of any circumstance in which it alters the number of times the (explicit)
code of (u myAdverb) gets called? I can't. But I can't get my head around
the case for (u myConjunction v) where u is non-trivial, i.e. not 0 or
infinity. Suppose u and v are relatively prime.

Not that this would matter for a mathematically well-behaved modifier, i.e.
one that doesn't change its internal state at each call, or use an
expensive or tricky resource, or display its operands, or keep a count of
the times it's called. But I suspect some of the Foreigns fall into that
category.

Now I've never met a case in practice where this would matter much… except
for the addon: 'debug/tte' (tacit-to-explicit) -where just about every
murky situation can arise. And it's of potential concern to beginners, not
just the most cognizant of cognoscenti.

At least it should be of concern to a beginner that debug/tte works, and
can be relied on. Some of its modifiers take a good hard look at their
operands to make decisions about how they're going to behave. Notably
(tteT_tte_) .The proposal might break the utility if it changes the operand
it sees.

Could you please test your prototype against tte to check it doesn't break?
debug/tte contains some handy samples, so you don't need to go constructing
them. See TEST_tte_ .

I'm ransacking my old brain here for 10-year-old knowledge. Abject
apologies if I'm making a mountain out of a molehill.

Ian Clark





On Sat, 23 Jan 2021 at 21:02, Henry Rich  wrote:


That's the idea.

Henry Rich

On 1/23/2021 4:01 PM, 'robert therriault' via Programming wrote:

So +"0 would run the same way as + and +"+ would disable special code?

I think that would work for me, should I need it (and I remember!)

Cheers, bob


On Jan 23, 2021, at 12:53, Henry Rich  wrote:

/Cognoscenti/ know that +"0 is slightly different from + and use that

fact wisely, to test or bypass special combinations.

Beginners are unaware of the difference and sometimes get poor

performance by needlessly adding a rank.

Fortunately there is a lot of beginner code out there!  And I think it

is time to fix JE so that u"n is exactly u if n is the same as the rank of
u.

To disable special code, write u"u (i. e. make the right operand of " a

verb).

Anybody gotta problem with that?

Henry Rich


--
This email has been checked for viruses by AVG.
https://www.avg.com

--
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



--
This email has been checked for viruses by AVG.
https://www.avg.com

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Show cause hearing: +"0 will be +

2021-01-23 Thread Ian Clark
As a career-beginner, most of the time I wouldn't notice. But I take it
this proposal would apply to verbs created from explicitly defined
modifiers too, not just primitives like (+)?

Is the (de)activation of special code the *only* side-effect? Can you think
of any circumstance in which it alters the number of times the (explicit)
code of (u myAdverb) gets called? I can't. But I can't get my head around
the case for (u myConjunction v) where u is non-trivial, i.e. not 0 or
infinity. Suppose u and v are relatively prime.

Not that this would matter for a mathematically well-behaved modifier, i.e.
one that doesn't change its internal state at each call, or use an
expensive or tricky resource, or display its operands, or keep a count of
the times it's called. But I suspect some of the Foreigns fall into that
category.

Now I've never met a case in practice where this would matter much… except
for the addon: 'debug/tte' (tacit-to-explicit) -where just about every
murky situation can arise. And it's of potential concern to beginners, not
just the most cognizant of cognoscenti.

At least it should be of concern to a beginner that debug/tte works, and
can be relied on. Some of its modifiers take a good hard look at their
operands to make decisions about how they're going to behave. Notably
(tteT_tte_) .The proposal might break the utility if it changes the operand
it sees.

Could you please test your prototype against tte to check it doesn't break?
debug/tte contains some handy samples, so you don't need to go constructing
them. See TEST_tte_ .

I'm ransacking my old brain here for 10-year-old knowledge. Abject
apologies if I'm making a mountain out of a molehill.

Ian Clark





On Sat, 23 Jan 2021 at 21:02, Henry Rich  wrote:

> That's the idea.
>
> Henry Rich
>
> On 1/23/2021 4:01 PM, 'robert therriault' via Programming wrote:
> > So +"0 would run the same way as + and +"+ would disable special code?
> >
> > I think that would work for me, should I need it (and I remember!)
> >
> > Cheers, bob
> >
> >> On Jan 23, 2021, at 12:53, Henry Rich  wrote:
> >>
> >> /Cognoscenti/ know that +"0 is slightly different from + and use that
> fact wisely, to test or bypass special combinations.
> >>
> >> Beginners are unaware of the difference and sometimes get poor
> performance by needlessly adding a rank.
> >>
> >> Fortunately there is a lot of beginner code out there!  And I think it
> is time to fix JE so that u"n is exactly u if n is the same as the rank of
> u.
> >>
> >> To disable special code, write u"u (i. e. make the right operand of " a
> verb).
> >>
> >> Anybody gotta problem with that?
> >>
> >> Henry Rich
> >>
> >>
> >> --
> >> This email has been checked for viruses by AVG.
> >> https://www.avg.com
> >>
> >> --
> >> 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


Re: [Jprogramming] Show cause hearing: +"0 will be +

2021-01-23 Thread Henry Rich

That's the idea.

Henry Rich

On 1/23/2021 4:01 PM, 'robert therriault' via Programming wrote:

So +"0 would run the same way as + and +"+ would disable special code?

I think that would work for me, should I need it (and I remember!)

Cheers, bob


On Jan 23, 2021, at 12:53, Henry Rich  wrote:

/Cognoscenti/ know that +"0 is slightly different from + and use that fact 
wisely, to test or bypass special combinations.

Beginners are unaware of the difference and sometimes get poor performance by 
needlessly adding a rank.

Fortunately there is a lot of beginner code out there!  And I think it is time to 
fix JE so that u"n is exactly u if n is the same as the rank of u.

To disable special code, write u"u (i. e. make the right operand of " a verb).

Anybody gotta problem with that?

Henry Rich


--
This email has been checked for viruses by AVG.
https://www.avg.com

--
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


Re: [Jprogramming] Show cause hearing: +"0 will be +

2021-01-23 Thread 'robert therriault' via Programming
So +"0 would run the same way as + and +"+ would disable special code?

I think that would work for me, should I need it (and I remember!)

Cheers, bob

> On Jan 23, 2021, at 12:53, Henry Rich  wrote:
> 
> /Cognoscenti/ know that +"0 is slightly different from + and use that fact 
> wisely, to test or bypass special combinations.
> 
> Beginners are unaware of the difference and sometimes get poor performance by 
> needlessly adding a rank.
> 
> Fortunately there is a lot of beginner code out there!  And I think it is 
> time to fix JE so that u"n is exactly u if n is the same as the rank of u.
> 
> To disable special code, write u"u (i. e. make the right operand of " a verb).
> 
> Anybody gotta problem with that?
> 
> Henry Rich
> 
> 
> -- 
> This email has been checked for viruses by AVG.
> https://www.avg.com
> 
> --
> For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


[Jprogramming] Show cause hearing: +"0 will be +

2021-01-23 Thread Henry Rich
/Cognoscenti/ know that +"0 is slightly different from + and use that 
fact wisely, to test or bypass special combinations.


Beginners are unaware of the difference and sometimes get poor 
performance by needlessly adding a rank.


Fortunately there is a lot of beginner code out there!  And I think it 
is time to fix JE so that u"n is exactly u if n is the same as the rank 
of u.


To disable special code, write u"u (i. e. make the right operand of " a 
verb).


Anybody gotta problem with that?

Henry Rich


--
This email has been checked for viruses by AVG.
https://www.avg.com

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Fields of 1!:0

2020-09-14 Thread David Mitchell

I squinted at the code some more.  Here is the real Linux (and likely Mac) 
Field 4:

start with out=:'--'
if file is user readable, and not writable,  out=:'r' 0 } out
if '.' = 0{filename,  out=:'h' 1 } out
if file is a dir, out=:'d' 4 } out

Cheers,
David

On 9/14/2020 10:46, 'robert therriault' via Programming wrote:

6 fields for Mac as well

 1!:0 '.'
┌─┬──┬───┬───┬──┬──┐
│.│2020 8 15 17 42 27│512│rwx│-h--d-│drwxr-xr-x│
└─┴──┴───┴───┴──┴──┘
JVERSION
Engine: j902/j64avx2/darwin
Beta-e: commercial/2020-08-14T13:00:52
Library: 9.02.05
Qt IDE: 1.8.7/5.12.7(5.12.7)
Platform: Darwin 64
Installer: J902 install
InstallPath: /users/bobtherriault/j902
Contact: www.jsoftware.com

Cheers, bob


On Sep 14, 2020, at 06:24, David Mitchell  wrote:

Linux has returned 6 fields and Windows 5 for some time.

Looking at xd.c, the 6th field is this :
  Return mode_t formatted into 11-character buffer

Field 4 seems to be the owning directory information.

Cheers,
David

On 9/14/2020 03:34, ethiejiesa via Programming wrote:

Right now, NuVoc documents that the rows returned by (1!:0) have 5 fields, but
I am seeing 6 in my version and platform:
1!:0 '.'
 ┌─┬──┬───┬───┬──┬──┐
 │.│2019 9 14 10 51 16│264│rwx│-h--d-│drwxr-xr-x│
 └─┴──┴───┴───┴──┴──┘
JVERSION
 Engine: j901-f/j64/linux
 Release: GPL3/2020-08-04T13:27:14
 Library: 9.01.24
 Platform: Linux 64
 Installer: unknown
 InstallPath: /usr/share/j
 Contact: voidlinux.org
Would like to update the wiki, so could someone confirm what the 6th field is?
The 6th fields looks like what you see with `stat --format=%A', i.e. a
effectively a stat(2) syscall on linux. However, how do the "permissions" of
field 4 relate to this? Also, what does the 6th field look like for Windows
users?
Cheers!
--
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


Re: [Jprogramming] Fields of 1!:0

2020-09-14 Thread 'robert therriault' via Programming
6 fields for Mac as well

1!:0 '.'
┌─┬──┬───┬───┬──┬──┐
│.│2020 8 15 17 42 27│512│rwx│-h--d-│drwxr-xr-x│
└─┴──┴───┴───┴──┴──┘
   JVERSION
Engine: j902/j64avx2/darwin
Beta-e: commercial/2020-08-14T13:00:52
Library: 9.02.05
Qt IDE: 1.8.7/5.12.7(5.12.7)
Platform: Darwin 64
Installer: J902 install
InstallPath: /users/bobtherriault/j902
Contact: www.jsoftware.com

Cheers, bob

> On Sep 14, 2020, at 06:24, David Mitchell  wrote:
> 
> Linux has returned 6 fields and Windows 5 for some time.
> 
> Looking at xd.c, the 6th field is this :
>  Return mode_t formatted into 11-character buffer
> 
> Field 4 seems to be the owning directory information.
> 
> Cheers,
> David
> 
> On 9/14/2020 03:34, ethiejiesa via Programming wrote:
>> Right now, NuVoc documents that the rows returned by (1!:0) have 5 fields, 
>> but
>> I am seeing 6 in my version and platform:
>>1!:0 '.'
>> ┌─┬──┬───┬───┬──┬──┐
>> │.│2019 9 14 10 51 16│264│rwx│-h--d-│drwxr-xr-x│
>> └─┴──┴───┴───┴──┴──┘
>>JVERSION
>> Engine: j901-f/j64/linux
>> Release: GPL3/2020-08-04T13:27:14
>> Library: 9.01.24
>> Platform: Linux 64
>> Installer: unknown
>> InstallPath: /usr/share/j
>> Contact: voidlinux.org
>> Would like to update the wiki, so could someone confirm what the 6th field 
>> is?
>> The 6th fields looks like what you see with `stat --format=%A', i.e. a
>> effectively a stat(2) syscall on linux. However, how do the "permissions" of
>> field 4 relate to this? Also, what does the 6th field look like for Windows
>> users?
>> Cheers!
>> --
>> 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


Re: [Jprogramming] Fields of 1!:0

2020-09-14 Thread David Mitchell

Linux has returned 6 fields and Windows 5 for some time.

Looking at xd.c, the 6th field is this :
  Return mode_t formatted into 11-character buffer

Field 4 seems to be the owning directory information.

Cheers,
David

On 9/14/2020 03:34, ethiejiesa via Programming wrote:

Right now, NuVoc documents that the rows returned by (1!:0) have 5 fields, but
I am seeing 6 in my version and platform:

1!:0 '.'
 ┌─┬──┬───┬───┬──┬──┐
 │.│2019 9 14 10 51 16│264│rwx│-h--d-│drwxr-xr-x│
 └─┴──┴───┴───┴──┴──┘

JVERSION
 Engine: j901-f/j64/linux
 Release: GPL3/2020-08-04T13:27:14
 Library: 9.01.24
 Platform: Linux 64
 Installer: unknown
 InstallPath: /usr/share/j
 Contact: voidlinux.org

Would like to update the wiki, so could someone confirm what the 6th field is?

The 6th fields looks like what you see with `stat --format=%A', i.e. a
effectively a stat(2) syscall on linux. However, how do the "permissions" of
field 4 relate to this? Also, what does the 6th field look like for Windows
users?

Cheers!
--
For information about J forums see http://www.jsoftware.com/forums.htm


--
For information about J forums see http://www.jsoftware.com/forums.htm


[Jprogramming] Fields of 1!:0

2020-09-14 Thread ethiejiesa via Programming
Right now, NuVoc documents that the rows returned by (1!:0) have 5 fields, but
I am seeing 6 in my version and platform:

   1!:0 '.'
┌─┬──┬───┬───┬──┬──┐
│.│2019 9 14 10 51 16│264│rwx│-h--d-│drwxr-xr-x│
└─┴──┴───┴───┴──┴──┘

   JVERSION
Engine: j901-f/j64/linux
Release: GPL3/2020-08-04T13:27:14
Library: 9.01.24
Platform: Linux 64
Installer: unknown
InstallPath: /usr/share/j
Contact: voidlinux.org

Would like to update the wiki, so could someone confirm what the 6th field is?

The 6th fields looks like what you see with `stat --format=%A', i.e. a
effectively a stat(2) syscall on linux. However, how do the "permissions" of
field 4 relate to this? Also, what does the 6th field look like for Windows
users?

Cheers!
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] rank error for 0: ` 1: ` 2: @. (3&|) i.7

2020-06-08 Thread Henry Rich
All that's as should be... except the crash.  That is now fixed for the 
next beta.  The code was passing inplacing info to a gerund that 
couldn't take it.


Thanks for the testing,

Henry Rich

On 6/8/2020 12:03 PM, Devon McCormick wrote:

This seems to crash J 9.02 under Windows 10:
test2 =. (1&+)`(2&*)`(3&%~) @. (3&|)
test2 i.7
In J 9.01, I get rank errors for arguments of "i.6" and "i.7" with this
definition.

This
test3 =. (1+])`(2*])`(3%~]) @. (3&|)
gives the expected result in 9.02 but a rank error in 9.01.  However if I
define this
test4 =. (1+])`(2*])`(3%~]) @. (3&|)"0
it gives the same answer in 9.01 as "test3" gives in 9.02.


On Mon, Jun 8, 2020 at 10:10 AM Henry Rich  wrote:


0: ` 1: ` 2: @. (3&|)"0

is the same as

(0: ` 1: ` 2: @. (3&|))"0

you are running the whole agenda at rank 0, processing each
argument-atom separately and assembling the results.


If instead you use

0: ` 1: ` 2: @. ((3&|)"0)

you haven't achieved anything: (3&|) and (3&|)"0 produce the same
result, and (3&|)"0 is slower because of the rank looping.


Part of your problem here is that you are using toy gerunds.  0: has
infinite rank and produces an atom no matter what the argument.  (2&+)
on the other hand has infinite rank, but it produces a result with the
shape of its argument.  You want to use gerunds like (2&+), whose
result-shape depends on the argument-shape.


I can't produce a rank error for (test1 i. 6).   There are two paths in
the gerund code: the old-fashioned way, executing one gerund on each
cell, for use when there are few cells; and the new way, which collects
the cells that have the same selector and executes each gerund once on
an array of those cells.  The new way is much faster when there are many
cells, but it fails if the verb is ill-behaved when given a list of
cells.  The old way works even if the verb is ill-behaved.  If I am
going to use the old way, I have no way of divining that the new way
would have failed, which is what it would take to raise a rank error.

Henry Rich

On 6/8/2020 8:45 AM, çağlar girit wrote:

Hello Henry,

Yes I'm using J9.02. I saw your explanation in the NuVoc writeup about

the

implied rank and had solved the problem as you show in the examples,

 test2 =. 0: ` 1: ` 2: @. (3&|)"0
by specifying the rank of the test-verb instead of each gerund-verb. From
the discussion at the bottom of the page, using atomic rank for the
test-verb is more efficient than specifying for the gerund-verbs, right?

Since test1 didn't throw a rank error for i.6, and from reading the

writeup

it seemed like it should, I thought I must be missing something deeper.

As

a J beginner I blame my understanding of the language rather than the

beta.

Perhaps it would be good if J9.02 also threw a rank error.

Thanks,
Çağlar



--
This email has been checked for viruses by AVG.
https://www.avg.com

--
For information about J forums see http://www.jsoftware.com/forums.htm






--
This email has been checked for viruses by AVG.
https://www.avg.com

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] rank error for 0: ` 1: ` 2: @. (3&|) i.7

2020-06-08 Thread Devon McCormick
This seems to crash J 9.02 under Windows 10:
   test2 =. (1&+)`(2&*)`(3&%~) @. (3&|)
   test2 i.7
In J 9.01, I get rank errors for arguments of "i.6" and "i.7" with this
definition.

This
   test3 =. (1+])`(2*])`(3%~]) @. (3&|)
gives the expected result in 9.02 but a rank error in 9.01.  However if I
define this
   test4 =. (1+])`(2*])`(3%~]) @. (3&|)"0
it gives the same answer in 9.01 as "test3" gives in 9.02.


On Mon, Jun 8, 2020 at 10:10 AM Henry Rich  wrote:

> 0: ` 1: ` 2: @. (3&|)"0
>
> is the same as
>
> (0: ` 1: ` 2: @. (3&|))"0
>
> you are running the whole agenda at rank 0, processing each
> argument-atom separately and assembling the results.
>
>
> If instead you use
>
> 0: ` 1: ` 2: @. ((3&|)"0)
>
> you haven't achieved anything: (3&|) and (3&|)"0 produce the same
> result, and (3&|)"0 is slower because of the rank looping.
>
>
> Part of your problem here is that you are using toy gerunds.  0: has
> infinite rank and produces an atom no matter what the argument.  (2&+)
> on the other hand has infinite rank, but it produces a result with the
> shape of its argument.  You want to use gerunds like (2&+), whose
> result-shape depends on the argument-shape.
>
>
> I can't produce a rank error for (test1 i. 6).   There are two paths in
> the gerund code: the old-fashioned way, executing one gerund on each
> cell, for use when there are few cells; and the new way, which collects
> the cells that have the same selector and executes each gerund once on
> an array of those cells.  The new way is much faster when there are many
> cells, but it fails if the verb is ill-behaved when given a list of
> cells.  The old way works even if the verb is ill-behaved.  If I am
> going to use the old way, I have no way of divining that the new way
> would have failed, which is what it would take to raise a rank error.
>
> Henry Rich
>
> On 6/8/2020 8:45 AM, çağlar girit wrote:
> > Hello Henry,
> >
> > Yes I'm using J9.02. I saw your explanation in the NuVoc writeup about
> the
> > implied rank and had solved the problem as you show in the examples,
> >
> > test2 =. 0: ` 1: ` 2: @. (3&|)"0
> > by specifying the rank of the test-verb instead of each gerund-verb. From
> > the discussion at the bottom of the page, using atomic rank for the
> > test-verb is more efficient than specifying for the gerund-verbs, right?
> >
> > Since test1 didn't throw a rank error for i.6, and from reading the
> writeup
> > it seemed like it should, I thought I must be missing something deeper.
> As
> > a J beginner I blame my understanding of the language rather than the
> beta.
> > Perhaps it would be good if J9.02 also threw a rank error.
> >
> > Thanks,
> > Çağlar
> >
>
>
> --
> This email has been checked for viruses by AVG.
> https://www.avg.com
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

Quantitative Consultant
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] rank error for 0: ` 1: ` 2: @. (3&|) i.7

2020-06-08 Thread Henry Rich

0: ` 1: ` 2: @. (3&|)"0

is the same as

(0: ` 1: ` 2: @. (3&|))"0

you are running the whole agenda at rank 0, processing each 
argument-atom separately and assembling the results.



If instead you use

0: ` 1: ` 2: @. ((3&|)"0)

you haven't achieved anything: (3&|) and (3&|)"0 produce the same 
result, and (3&|)"0 is slower because of the rank looping.



Part of your problem here is that you are using toy gerunds.  0: has 
infinite rank and produces an atom no matter what the argument.  (2&+) 
on the other hand has infinite rank, but it produces a result with the 
shape of its argument.  You want to use gerunds like (2&+), whose 
result-shape depends on the argument-shape.



I can't produce a rank error for (test1 i. 6).   There are two paths in 
the gerund code: the old-fashioned way, executing one gerund on each 
cell, for use when there are few cells; and the new way, which collects 
the cells that have the same selector and executes each gerund once on 
an array of those cells.  The new way is much faster when there are many 
cells, but it fails if the verb is ill-behaved when given a list of 
cells.  The old way works even if the verb is ill-behaved.  If I am 
going to use the old way, I have no way of divining that the new way 
would have failed, which is what it would take to raise a rank error.


Henry Rich

On 6/8/2020 8:45 AM, çağlar girit wrote:

Hello Henry,

Yes I'm using J9.02. I saw your explanation in the NuVoc writeup about the
implied rank and had solved the problem as you show in the examples,

test2 =. 0: ` 1: ` 2: @. (3&|)"0
by specifying the rank of the test-verb instead of each gerund-verb. From
the discussion at the bottom of the page, using atomic rank for the
test-verb is more efficient than specifying for the gerund-verbs, right?

Since test1 didn't throw a rank error for i.6, and from reading the writeup
it seemed like it should, I thought I must be missing something deeper. As
a J beginner I blame my understanding of the language rather than the beta.
Perhaps it would be good if J9.02 also threw a rank error.

Thanks,
Çağlar




--
This email has been checked for viruses by AVG.
https://www.avg.com

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] rank error for 0: ` 1: ` 2: @. (3&|) i.7

2020-06-08 Thread Hauke Rehr

Does this test2 actually “specify the rank on the test verb?”
I think " takes the entire verb phrase to its left which imo
is the result of the agenda, not the test only.

Am 08.06.20 um 14:45 schrieb çağlar girit:

Hello Henry,

Yes I'm using J9.02. I saw your explanation in the NuVoc writeup about the
implied rank and had solved the problem as you show in the examples,

test2 =. 0: ` 1: ` 2: @. (3&|)"0
by specifying the rank of the test-verb instead of each gerund-verb. From
the discussion at the bottom of the page, using atomic rank for the
test-verb is more efficient than specifying for the gerund-verbs, right?

Since test1 didn't throw a rank error for i.6, and from reading the writeup
it seemed like it should, I thought I must be missing something deeper. As
a J beginner I blame my understanding of the language rather than the beta.
Perhaps it would be good if J9.02 also threw a rank error.

Thanks,
Çağlar



--
--
mail written using NEO
neo-layout.org

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] rank error for 0: ` 1: ` 2: @. (3&|) i.7

2020-06-08 Thread çağlar girit
Hello Henry,

Yes I'm using J9.02. I saw your explanation in the NuVoc writeup about the
implied rank and had solved the problem as you show in the examples,

   test2 =. 0: ` 1: ` 2: @. (3&|)"0
by specifying the rank of the test-verb instead of each gerund-verb. From
the discussion at the bottom of the page, using atomic rank for the
test-verb is more efficient than specifying for the gerund-verbs, right?

Since test1 didn't throw a rank error for i.6, and from reading the writeup
it seemed like it should, I thought I must be missing something deeper. As
a J beginner I blame my understanding of the language rather than the beta.
Perhaps it would be good if J9.02 also threw a rank error.

Thanks,
Çağlar

-- 
çög
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] rank error for 0: ` 1: ` 2: @. (3&|) i.7

2020-06-07 Thread Henry Rich

test1=: 0:`1:`2: @. (3&|)

For J9.01 and earlier,

test1 i. 6 is a rank error because execution of (3&|)  doesn't produce 
an atom.


So you guys must be using J9.02.  Thanks for helping out!

Starting in 9.02, this doesn't automatically produce a rank error.  
Instead, the result of (3&| i. 6/7) is inspected.  It is seen to produce 
a result with the same shape as (i. 6): that is, there is one 
result-atom for each atom of (y).  This means that the implied rank of 
the verbs in (0:`1:`2:) is 0: each verb is assumed to produce a result 
for each 0-cell (i. e. atom) of input.


[Note that this is a requirement on the gerund-verb.  The gerund is not 
executed with rank 0: that would be inefficient.  Rather, the gerund 
must behave properly when given an argument of rank > 0.]


[if the selector-verb were (3 | +/"1) and the argument were (i. 3 6), 
the selector would produce a result with shape (,3) and the JE would 
conclude that the implied rank of the gerund-verbs is 1.]


The gerunds are then executed as called for by the result of (3&|).  How 
many times are they executed?  That's none of your business - the JE 
might execute them one at a time, or it might group them together.  When 
you execute (test1 i. 6), the JE executes each gerund on an atom, and 
you get no error.


But when you execute (test1 i. 7), the JE decides differently.  It 
collects the inputs to the first gerund (0 3 6) and passes them in a 
single call to the verb (0:).  Remember, the verb is charged with giving 
a result on each atom.  But this verb doesn't.  It gives a single atomic 
result, which is a rank error because it is not the 3 results expected.


How to fix it?  Make each gerund follow the rules, and give a result on 
each atom.  A simple way, inefficient in general, is to make sure the 
rank of each gerund is the implied rank of the verb:


   test1a=: 0"0`(1"0)`(2"0) @. (3&|)
   test1a i. 7
0 1 2 0 1 2 0

The gerund-verb can have a higher rank if it is well-behaved:

   test1b=: 0"0`(3&|)`(3&|) @. (3&|)
   test1b i. 7
0 1 2 0 1 2 0



This is what I was trying to say in the NuVoc writeup.  If you would 
reread it and tell me what's unclear, or just fix the Wiki yourself, I'd 
be obliged.


Henry Rich


On 6/7/2020 1:18 PM, Devon McCormick wrote:

I see the same anomaly for the "i.7" argument on J 9.02.03 under Windows 10:
test1=: 0:`1:`2: @. (3&|)
test1 &.> i.&.> >:i.6
+-+---+-+---+-+---+
|0|0 1|0 1 2|0 1 2 0|0 1 2 0 1|0 1 2 0 1 2|
+-+---+-+---+-+---+
test1 i.7
|rank error: test1
|test1[0]
   dbr 1 [ dbr 0
test1 i.100
|rank error: test1
|test1[0]

But defining "test1" with scalar rank does not exhibit this behavior:
test1=: 0:`1:`2: @. (3&|)"0
test1&.>i.&.>7+i.3
+-+---+-+
|0 1 2 0 1 2 0|0 1 2 0 1 2 0 1|0 1 2 0 1 2 0 1 2|
+-+---+-+


On Sun, Jun 7, 2020 at 10:39 AM Hauke Rehr  wrote:


test1 i.6
doesn’t work for me either

but both
test1"0 i.6
and
test1"0 i.7
do work as expected

Am 07.06.20 um 16:35 schrieb çağlar girit:

Hi,

Although I have read NuVoc entries for Agenda and Constant Function, I
still don't understand why for "test1 =. 0: ` 1: ` 2: @. (3&|)", "test1

i.

6" works whereas "test2 i.7" gives a rank error.  Am I missing some
subtlety of implied rank with Agenda?

test1 =. 0: ` 1: ` 2: @. (3&|)
test1 i.6
0 1 2 0 1 2
 test1 i.7
|rank error: test1
|   test1 i.7

Thanks!



--
--
mail written using NEO
neo-layout.org

--
For information about J forums see http://www.jsoftware.com/forums.htm






--
This email has been checked for viruses by AVG.
https://www.avg.com

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] rank error for 0: ` 1: ` 2: @. (3&|) i.7

2020-06-07 Thread Don Guinn
Oops! Typo earlier

test1 1 1 1 1 1 1 1

|rank error: test1

| test1 1 1 1 1 1 1 1

On Sun, Jun 7, 2020 at 12:20 PM Don Guinn  wrote:

> test1 =. 0: ` 1: ` 2: @. (3&|)
>
> test1 i.6
>
> 0 1 2 0 1 2
>
> test1 i.7
>
> |rank error: test1
>
> | test1 i.7
>
> test1 >:i.6
>
> 1 2 0 1 2 0
>
> test 1 1 1 1 1 1 1
>
> |domain error: test
>
> | jdo'ABC=:' ,y
>
> On Sun, Jun 7, 2020 at 11:19 AM Devon McCormick 
> wrote:
>
>> I see the same anomaly for the "i.7" argument on J 9.02.03 under Windows
>> 10:
>>test1=: 0:`1:`2: @. (3&|)
>>test1 &.> i.&.> >:i.6
>> +-+---+-+---+-+---+
>> |0|0 1|0 1 2|0 1 2 0|0 1 2 0 1|0 1 2 0 1 2|
>> +-+---+-+---+-+---+
>>test1 i.7
>> |rank error: test1
>> |test1[0]
>>   dbr 1 [ dbr 0
>>test1 i.100
>> |rank error: test1
>> |test1[0]
>>
>> But defining "test1" with scalar rank does not exhibit this behavior:
>>test1=: 0:`1:`2: @. (3&|)"0
>>test1&.>i.&.>7+i.3
>> +-+---+-+
>> |0 1 2 0 1 2 0|0 1 2 0 1 2 0 1|0 1 2 0 1 2 0 1 2|
>> +-+---+-+
>>
>>
>> On Sun, Jun 7, 2020 at 10:39 AM Hauke Rehr 
>> wrote:
>>
>> > test1 i.6
>> > doesn’t work for me either
>> >
>> > but both
>> > test1"0 i.6
>> > and
>> > test1"0 i.7
>> > do work as expected
>> >
>> > Am 07.06.20 um 16:35 schrieb çağlar girit:
>> > > Hi,
>> > >
>> > > Although I have read NuVoc entries for Agenda and Constant Function, I
>> > > still don't understand why for "test1 =. 0: ` 1: ` 2: @. (3&|)",
>> "test1
>> > i.
>> > > 6" works whereas "test2 i.7" gives a rank error.  Am I missing some
>> > > subtlety of implied rank with Agenda?
>> > >
>> > >test1 =. 0: ` 1: ` 2: @. (3&|)
>> > >test1 i.6
>> > > 0 1 2 0 1 2
>> > > test1 i.7
>> > > |rank error: test1
>> > > |   test1 i.7
>> > >
>> > > Thanks!
>> > >
>> > >
>> >
>> > --
>> > --
>> > mail written using NEO
>> > neo-layout.org
>> >
>> > --
>> > For information about J forums see http://www.jsoftware.com/forums.htm
>> >
>>
>>
>> --
>>
>> Devon McCormick, CFA
>>
>> Quantitative Consultant
>> --
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] rank error for 0: ` 1: ` 2: @. (3&|) i.7

2020-06-07 Thread Don Guinn
test1 =. 0: ` 1: ` 2: @. (3&|)

test1 i.6

0 1 2 0 1 2

test1 i.7

|rank error: test1

| test1 i.7

test1 >:i.6

1 2 0 1 2 0

test 1 1 1 1 1 1 1

|domain error: test

| jdo'ABC=:' ,y

On Sun, Jun 7, 2020 at 11:19 AM Devon McCormick  wrote:

> I see the same anomaly for the "i.7" argument on J 9.02.03 under Windows
> 10:
>test1=: 0:`1:`2: @. (3&|)
>test1 &.> i.&.> >:i.6
> +-+---+-+---+-+---+
> |0|0 1|0 1 2|0 1 2 0|0 1 2 0 1|0 1 2 0 1 2|
> +-+---+-+---+-+---+
>test1 i.7
> |rank error: test1
> |test1[0]
>   dbr 1 [ dbr 0
>test1 i.100
> |rank error: test1
> |test1[0]
>
> But defining "test1" with scalar rank does not exhibit this behavior:
>test1=: 0:`1:`2: @. (3&|)"0
>test1&.>i.&.>7+i.3
> +-+---+-+
> |0 1 2 0 1 2 0|0 1 2 0 1 2 0 1|0 1 2 0 1 2 0 1 2|
> +-+---+-+
>
>
> On Sun, Jun 7, 2020 at 10:39 AM Hauke Rehr  wrote:
>
> > test1 i.6
> > doesn’t work for me either
> >
> > but both
> > test1"0 i.6
> > and
> > test1"0 i.7
> > do work as expected
> >
> > Am 07.06.20 um 16:35 schrieb çağlar girit:
> > > Hi,
> > >
> > > Although I have read NuVoc entries for Agenda and Constant Function, I
> > > still don't understand why for "test1 =. 0: ` 1: ` 2: @. (3&|)", "test1
> > i.
> > > 6" works whereas "test2 i.7" gives a rank error.  Am I missing some
> > > subtlety of implied rank with Agenda?
> > >
> > >test1 =. 0: ` 1: ` 2: @. (3&|)
> > >test1 i.6
> > > 0 1 2 0 1 2
> > > test1 i.7
> > > |rank error: test1
> > > |   test1 i.7
> > >
> > > Thanks!
> > >
> > >
> >
> > --
> > --
> > mail written using NEO
> > neo-layout.org
> >
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
>
>
> --
>
> Devon McCormick, CFA
>
> Quantitative Consultant
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] rank error for 0: ` 1: ` 2: @. (3&|) i.7

2020-06-07 Thread Devon McCormick
I see the same anomaly for the "i.7" argument on J 9.02.03 under Windows 10:
   test1=: 0:`1:`2: @. (3&|)
   test1 &.> i.&.> >:i.6
+-+---+-+---+-+---+
|0|0 1|0 1 2|0 1 2 0|0 1 2 0 1|0 1 2 0 1 2|
+-+---+-+---+-+---+
   test1 i.7
|rank error: test1
|test1[0]
  dbr 1 [ dbr 0
   test1 i.100
|rank error: test1
|test1[0]

But defining "test1" with scalar rank does not exhibit this behavior:
   test1=: 0:`1:`2: @. (3&|)"0
   test1&.>i.&.>7+i.3
+-+---+-+
|0 1 2 0 1 2 0|0 1 2 0 1 2 0 1|0 1 2 0 1 2 0 1 2|
+-+---+-+


On Sun, Jun 7, 2020 at 10:39 AM Hauke Rehr  wrote:

> test1 i.6
> doesn’t work for me either
>
> but both
> test1"0 i.6
> and
> test1"0 i.7
> do work as expected
>
> Am 07.06.20 um 16:35 schrieb çağlar girit:
> > Hi,
> >
> > Although I have read NuVoc entries for Agenda and Constant Function, I
> > still don't understand why for "test1 =. 0: ` 1: ` 2: @. (3&|)", "test1
> i.
> > 6" works whereas "test2 i.7" gives a rank error.  Am I missing some
> > subtlety of implied rank with Agenda?
> >
> >test1 =. 0: ` 1: ` 2: @. (3&|)
> >test1 i.6
> > 0 1 2 0 1 2
> > test1 i.7
> > |rank error: test1
> > |   test1 i.7
> >
> > Thanks!
> >
> >
>
> --
> --
> mail written using NEO
> neo-layout.org
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

Quantitative Consultant
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] rank error for 0: ` 1: ` 2: @. (3&|) i.7

2020-06-07 Thread Hauke Rehr

test1 i.6
doesn’t work for me either

but both
test1"0 i.6
and
test1"0 i.7
do work as expected

Am 07.06.20 um 16:35 schrieb çağlar girit:

Hi,

Although I have read NuVoc entries for Agenda and Constant Function, I
still don't understand why for "test1 =. 0: ` 1: ` 2: @. (3&|)", "test1 i.
6" works whereas "test2 i.7" gives a rank error.  Am I missing some
subtlety of implied rank with Agenda?

   test1 =. 0: ` 1: ` 2: @. (3&|)
   test1 i.6
0 1 2 0 1 2
test1 i.7
|rank error: test1
|   test1 i.7

Thanks!




--
--
mail written using NEO
neo-layout.org

--
For information about J forums see http://www.jsoftware.com/forums.htm


[Jprogramming] rank error for 0: ` 1: ` 2: @. (3&|) i.7

2020-06-07 Thread çağlar girit
Hi,

Although I have read NuVoc entries for Agenda and Constant Function, I
still don't understand why for "test1 =. 0: ` 1: ` 2: @. (3&|)", "test1 i.
6" works whereas "test2 i.7" gives a rank error.  Am I missing some
subtlety of implied rank with Agenda?

  test1 =. 0: ` 1: ` 2: @. (3&|)
  test1 i.6
0 1 2 0 1 2
   test1 i.7
|rank error: test1
|   test1 i.7

Thanks!


-- 
çög
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] a: is not $0

2014-02-19 Thread Henry Rich

Here's the answer:

   test =: ' ' , [: {. '' , 
   test a:

   test $0
|domain error: test
|   test$0
   test 0$0

Henry Rich

On 2/18/2014 12:51 AM, km wrote:

Henry, experiments with 3!:3 make me guess 0$0 as a correct definition of a: 
but I have no clue how to define verb test.  --Kip Murray

Sent from my iPad


On Feb 15, 2014, at 11:28 AM, Henry Rich henryhr...@nc.rr.com wrote:

The Dictionary defines a: as $0, but in fact the two are not interchangeable.

The challenge is to demonstrate this: write a verb that produces a result when 
applied to a:, but gives domain error when applied to $0 .

   test a:

   test $0
|domain error: test
|   test$0


Then, give a correct definition of a: .

Henry Rich
--
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


Re: [Jprogramming] a: is not $0

2014-02-19 Thread Thomas Costigliola
Very interesting Henry. This seems to be a coincidental side effect of the
fact that the integer flag for booleans is less than the flag for literals
as specified here:
http://www.jsoftware.com/docs/help701/dictionary/dx003.htm

Now, I wonder if forcing the boolean to stay numeric would wreak havoc
elsewhere?


On Wed, Feb 19, 2014 at 4:48 PM, Henry Rich henryhr...@nc.rr.com wrote:

 Here's the answer:

test =: ' ' , [: {. '' , 

test a:

test $0
 |domain error: test
 |   test$0
test 0$0

 Henry Rich


 On 2/18/2014 12:51 AM, km wrote:

 Henry, experiments with 3!:3 make me guess 0$0 as a correct definition
 of a: but I have no clue how to define verb test.  --Kip Murray

 Sent from my iPad

  On Feb 15, 2014, at 11:28 AM, Henry Rich henryhr...@nc.rr.com wrote:

 The Dictionary defines a: as $0, but in fact the two are not
 interchangeable.

 The challenge is to demonstrate this: write a verb that produces a
 result when applied to a:, but gives domain error when applied to $0 .

test a:

test $0
 |domain error: test
 |   test$0


 Then, give a correct definition of a: .

 Henry Rich
 --
 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


Re: [Jprogramming] a: is not $0

2014-02-17 Thread km
Henry, experiments with 3!:3 make me guess 0$0 as a correct definition of a: 
but I have no clue how to define verb test.  --Kip Murray

Sent from my iPad

 On Feb 15, 2014, at 11:28 AM, Henry Rich henryhr...@nc.rr.com wrote:
 
 The Dictionary defines a: as $0, but in fact the two are not interchangeable.
 
 The challenge is to demonstrate this: write a verb that produces a result 
 when applied to a:, but gives domain error when applied to $0 .
 
   test a:
 
   test $0
 |domain error: test
 |   test$0
 
 
 Then, give a correct definition of a: .
 
 Henry Rich
 --
 For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] a: is not $0

2014-02-15 Thread Henry Rich
I didn't use any foreigns in my version of the verb.  The only point I'm 
trying to make is that a: and $0 are different.


Henry Rich

On 2/15/2014 1:10 PM, Raul Miller wrote:

Does it have to be a domain error? We had an example bug involving a limit
error just a few days ago. Or are foreigns off limits?

Thanks,


--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] a: is not $0

2014-02-15 Thread Raul Miller
Certainly,

   3!:0  a:  NB. boolean
1
   3!:0  $0   NB. integer
4

But what we are working with here is two representations of the same value
-- most differences which do not involve foreigns should probably be
thought of as errors.

-- 
Raul



On Sat, Feb 15, 2014 at 1:19 PM, Henry Rich henryhr...@nc.rr.com wrote:

 I didn't use any foreigns in my version of the verb.  The only point I'm
 trying to make is that a: and $0 are different.

 Henry Rich


 On 2/15/2014 1:10 PM, Raul Miller wrote:

 Does it have to be a domain error? We had an example bug involving a limit
 error just a few days ago. Or are foreigns off limits?

 Thanks,

  --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] a: is not $0

2014-02-15 Thread Henry Rich
You are right, but what verb (without foreigns) would expose that 
difference?


Henry Rich

On 2/15/2014 1:41 PM, Raul Miller wrote:

Certainly,

3!:0  a:  NB. boolean
1
3!:0  $0   NB. integer
4

But what we are working with here is two representations of the same value
-- most differences which do not involve foreigns should probably be
thought of as errors.


--
For information about J forums see http://www.jsoftware.com/forums.htm