Re: [Jprogramming] from vs fetch

2020-07-19 Thread Igor Zhuravlov
NB. x {:: y ((0 ; 1) , (1 ; 1) ,: (2 ; 1)) {:: y 2 4 6 NB. io foo y 1 (((,. <)~ <"0@i.@#) {:: ]) y 2 4 6 Inspired by the last section "To select subarray" in "Common uses" of https://code.jsoftware.com/wiki/Vocabulary/curlylfcoco#dyadic -- Regards Igor On Sun, Jul 19, 2020 at 7:18

Re: [Jprogramming] Representing trees

2020-07-19 Thread 'Bo Jacoby' via Programming
I use ordinal fractions. nms=.'000';'100';'200';'110';'120';'210';'220';'230';'211';'221';'222';'223' The digits are ordinal numbers, 1, 2, 3, . . . rather than cardinal numbers 0, 1, 2, . . . The digit zero means everything rather than nothing.    nms=.'000','100','200','110','120','210',

Re: [Jprogramming] Representing trees

2020-07-19 Thread Jan-Pieter Jacobs
There's this one on the J wiki: https://code.jsoftware.com/wiki/Essays/Tree_Display It works very well, with a fair amount of sanity check, but uses a slightly different data format: a list of pairs of parent-child (i.e. N x 2). It can handle both unboxed numbers, or boxed literals. Best regards,

Re: [Jprogramming] Unexpected result

2020-07-19 Thread Henry Rich
Oh, that parse table.   ]A =: A , >:@:([ 3 :'echo A =: A , y')^:4 [ A =: , 0 0 0 0 0 1 0 0 1 2 0 0 1 2 3 0 4   ]A =: A , ] >:@:([ 3 :'echo A =: A , y')^:4 [ A =: , 0 0 0 0 0 1 0 0 1 2 0 0 1 2 3 0 0 1 2 3 4 Henry Rich On 7/19/2020 5:08 PM, David Lambert wrote: At the end of this senten

Re: [Jprogramming] Unexpected result

2020-07-19 Thread Julian Fondren
On 2020-07-19 16:10, Julian Fondren wrote: On 2020-07-19 16:08, David Lambert wrote: At the end of this sentence I had hoped the global variable A would have more items. A =: A , >:@:([ 3 :'echo A =: A , y')^:4 [ A =: , 0 0 0 0 0 1 0 0 1 2 0 0 1 2 3 A NB. The intermediate values we

Re: [Jprogramming] Unexpected result

2020-07-19 Thread Julian Fondren
On 2020-07-19 16:08, David Lambert wrote: At the end of this sentence I had hoped the global variable A would have more items. A =: A , >:@:([ 3 :'echo A =: A , y')^:4 [ A =: , 0 0 0 0 0 1 0 0 1 2 0 0 1 2 3 A NB. The intermediate values we need are gone! 0 4 A , >:@:([ 3 :'ech

[Jprogramming] Unexpected result

2020-07-19 Thread David Lambert
At the end of this sentence I had hoped the global variable A would have more items. A =: A , >:@:([ 3 :'echo A =: A , y')^:4 [ A =: , 0 0 0 0 0 1 0 0 1 2 0 0 1 2 3 A NB. The intermediate values we need are gone! 0 4 JVERSION Engine: j901/j64avx2/windows Release-c: commercial/2020-

Re: [Jprogramming] Representing trees

2020-07-19 Thread Julian Fondren
On 2020-07-19 15:12, Devon McCormick wrote: Any other neat representation of a tree would also be appreciated. High-performance Tree Wrangling, the APL Way: https://dyalog.tv/Dyalog18/?v=hzPd3umu78g I don't know how APL well enough to follow this very far, but he separates the structure of tre

[Jprogramming] Representing trees

2020-07-19 Thread Devon McCormick
Does anyone have a good way to display a tree in J? EG C: |__n0 | |_n00 | |_n01 | |__n1 |__n10 | |__n100 |__n11 | |__n110 | |__n111 | |__n112 |__n12 for a tree in parent index form: tr=. _1 001 1 22 2 5 6 6

Re: [Jprogramming] fixed pseudorandom ?. very pseudo on powers of 2

2020-07-19 Thread Julian Fondren
You can also implement ?. in terms of ? dealdot=: 3 : '? y [ 9!:1 ] 16807' mean=:+/%# mean"1(?."0,:?)100#1e3 194 544.81 mean"1(?.,:?)100#1e3 546.13 543.03 mean"1(dealdot,:?)100#1e3 541.14 517.69 mean"1(dealdot"0,:?)100#1e3 622 544.41 #@~."1 (dealdot"0 , dealdot , ?. , ?."0 ,

Re: [Jprogramming] fixed pseudorandom ?. very pseudo on powers of 2

2020-07-19 Thread bill lam
I can see ?. is biased and buggy, but many codes depend on this 'bug'. It is ok to implement a better ?. but only as another new primitive if there are enough user demand. On Mon, Jul 20, 2020 at 12:22 AM Skip Cave wrote: > It's clear that the statistical properties of ?. are repeatable, but the

Re: [Jprogramming] fixed pseudorandom ?. very pseudo on powers of 2

2020-07-19 Thread Skip Cave
It's clear that the statistical properties of ?. are repeatable, but they are are significantly different than ? mean"1(?."0,:?)2^i.50 3.98766e12 1.46478e13 mean"1(?."0,:?)2^i.50 3.98766e12 1.29535e13 mean"1(?."0,:?)2^i.50 3.98766e12 1.67325e13 mean"1(?."0,:?)2^i.50 3.98766e12 1.50923e13 m

Re: [Jprogramming] fixed pseudorandom ?. very pseudo on powers of 2

2020-07-19 Thread Henry Rich
It's not the JE test suite.  That doesn't rely on the details of ?. .  But there is user code, outside our control, that depends on the exact behavior of ?. . I know, because when I modified ? a while back to speed it up, I included the changes in ?. too and had to withdraw them under the hail

Re: [Jprogramming] fixed pseudorandom ?. very pseudo on powers of 2

2020-07-19 Thread Raul Miller
Well... I think we can agree that if ?. were replaced with 0: that that would not be random enough. So there has to be a better way of talking about this issue. If the current test suite is looking for hard coded results from ?. -- and I think it does -- then of course changing the ?. implementat

Re: [Jprogramming] fixed pseudorandom ?. very pseudo on powers of 2

2020-07-19 Thread bill lam
Even ?. is not good, it won't change. Its purpose is to provide repeatable random data for testing, it doesn't matter if it is not random enough. On Sun, Jul 19, 2020 at 11:41 PM Julian Fondren wrote: > On 2020-07-19 10:31, Brian Schott wrote: > > Yes, I see the problem you are describing better

Re: [Jprogramming] fixed pseudorandom ?. very pseudo on powers of 2

2020-07-19 Thread Julian Fondren
On 2020-07-19 10:31, Brian Schott wrote: Yes, I see the problem you are describing better now. This behavior for powers of 2 is dissimilar with other power bases. It suggests a flaw in the algorithm for ?. . ?.2^11 1826 ?.2^12 1826 ?.2^13 1826 NB. compared to the following ?.3^11 35

Re: [Jprogramming] fixed pseudorandom ?. very pseudo on powers of 2

2020-07-19 Thread Brian Schott
Yes, I see the problem you are describing better now. This behavior for powers of 2 is dissimilar with other power bases. It suggests a flaw in the algorithm for ?. . ?.2^11 1826 ?.2^12 1826 ?.2^13 1826 NB. compared to the following ?.3^11 35532 ?.3^12 212679 ?.3^13 1275561 On

Re: [Jprogramming] fixed pseudorandom ?. very pseudo on powers of 2

2020-07-19 Thread Hauke Rehr
Yes, this is the way one should do it: set a custom random seed. Thanks Am 19.07.20 um 17:09 schrieb Julian Fondren: On 2020-07-19 09:36, Hauke Rehr wrote: If you don’t know about this and try to work with powers of two, switching to ?. someday since you want reproducible results, you might

Re: [Jprogramming] fixed pseudorandom ?. very pseudo on powers of 2

2020-07-19 Thread Julian Fondren
On 2020-07-19 09:36, Hauke Rehr wrote: If you don’t know about this and try to work with powers of two, switching to ?. someday since you want reproducible results, you might end up with very bad results even though you tested the statistical properties when you were still dealing with ? For th

Re: [Jprogramming] fixed pseudorandom ?. very pseudo on powers of 2

2020-07-19 Thread Henry Rich
The program works as designed and intended.  If you want to add to NuVoc, pray do. Henry Rich On 7/19/2020 10:36 AM, Hauke Rehr wrote: Sure we want repeated results. But do we want the same results for all of    ?. 2^11    ?. 2^12    ?. 2^13 and the same results for all of    ?. 2^14    ?. 2^1

Re: [Jprogramming] fixed pseudorandom ?. very pseudo on powers of 2

2020-07-19 Thread Hauke Rehr
Sure we want repeated results. But do we want the same results for all of ?. 2^11 ?. 2^12 ?. 2^13 and the same results for all of ?. 2^14 ?. 2^15 ?. 2^16 ?. 2^17 ?. 2^18 ?. 2^19 ? If you don’t know about this and try to work with powers of two, switching to ?. someday si

Re: [Jprogramming] fixed pseudorandom ?. very pseudo on powers of 2

2020-07-19 Thread Henry Rich
The whole purpose of ?. is to give repeated results.  Every invocation of ?. plays the same canned sequence of the underlying RNG.    ?. 20 # 35 34 31 13 31 5 23 31 11 6 29 3 17 8 11 9 27 32 5 34 10    ?. 20 # 7 6 3 6 3 5 2 3 4 6 1 3 3 1 4 2 6 4 5 6 3 Notice anything?    7 | ?. 20 # 35 6 3 6 3

Re: [Jprogramming] from vs fetch

2020-07-19 Thread Henry Rich
Best I've got is    (0;1) {::"1 0 y 2 4 6 I would use    1 {&> y Henry Rich On 7/19/2020 5:18 AM, R.E. Boss wrote: In NUVOC https://code.jsoftware.com/wiki/Vocabulary/curlylf#dyadic I read : "A selector of a: designates an omitted axis which is taken in full." How is this done in https://c

Re: [Jprogramming] fixed pseudorandom ?. very pseudo on powers of 2

2020-07-19 Thread Brian Schott
I think the behavior is because of the rank of the argument of ?. . For example consider these rank examples. $2^3 $2^3+i.3 3 -- (B=) -- For information about J forums see http://www.jsoftware.com/forums.htm

[Jprogramming] fixed pseudorandom ?. very pseudo on powers of 2

2020-07-19 Thread Hauke Rehr
I have an issue using ?. . ?. 2^y gives the same result for several y in a row. If I do ?. 2^y+i.x for the same successive values, the rng will iterate and values differ. I understand the difference between the two invocations and think it’s okay for them to give different results; but I th

[Jprogramming] from vs fetch

2020-07-19 Thread R.E. Boss
In NUVOC https://code.jsoftware.com/wiki/Vocabulary/curlylf#dyadic I read : "A selector of a: designates an omitted axis which is taken in full." How is this done in https://code.jsoftware.com/wiki/Vocabulary/curlylfcoco#dyadic ? MWE. With from: ]y =. 1 2,3 4,:5 6 7 1 2 0 3 4 0 5 6 7 (<