« first day (1751 days earlier)      last day (911 days later) » 

12:39 AM
wow, n wise reduction uses a lot of space
 
Memory or screen space?
 
memory
      wsreq '3+⌿rand'
80000600
      ⎕SIZE 'rand'
5000040
oh, probably to do with the type having to change
 
Well, it has to create (≢⍵)-⍺-1 pointers.
No, that's for nested stuff.
 
it doesn't have to do that, the implementation chooses to do that which is inefficient
 
What is the shape of rand?
 
12:45 AM
1e6 5
 
How does it compare to (2↓rand)+(1↓¯1↓rand)+(¯2↓rand)?
What is ⎕DR'rand'?
 
yeah that uses less memory
80
 
Is rand←?1e6 5⍴127?
 
100 not 127 but yeah
 
The type must be 83 if it's integers, not chars
 
12:49 AM
That's what I figured rak meant.
 
oh, right, ⎕DR 'rand' is 80, ⎕DR rand is 83
@Adám no, I did what you asked :P
 
Oh lol :P
 
Oops.
This is not good:
    ]runtime -c 3+⌿rand (2↓rand)+(1↓¯1↓rand)+(¯2↓rand)

3+⌿rand                        → 1.1E¯2 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
(2↓rand)+(1↓¯1↓rand)+(¯2↓rand) → 5.0E¯3 | -56% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
yeah, surprising
 
Ouch:
    ]runtime -c 3+⌿rand (2↓rand)+(1↓¯1↓rand)+(¯2↓rand) 1↓¯1↓{+⌿⍵}⌺3⊢rand

3+⌿rand                        → 1.1E¯2 |      0%
(2↓rand)+(1↓¯1↓rand)+(¯2↓rand) → 4.0E¯3 |    -64%
1↓¯1↓{+⌿⍵}⌺3⊢rand              → 1.7E0  | +15013% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
12:51 AM
Oh dear
 
lol
 
Huh:
    rand←?5e6⍴127
    ]runtime -c 3+⌿rand (2↓rand)+(1↓¯1↓rand)+(¯2↓rand) 1↓¯1↓{+/⍵}⌺3⊢rand 1↓¯1↓{+⌿⍵}⌺3⊢rand

3+⌿rand                        → 1.1E¯2 |      0%
(2↓rand)+(1↓¯1↓rand)+(¯2↓rand) → 5.0E¯3 |    -55%
1↓¯1↓{+/⍵}⌺3⊢rand              → 4.0E¯3 |    -64%
1↓¯1↓{+⌿⍵}⌺3⊢rand              → 8.4E0  | +76436% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
For why the first is slower, could be issues with overflow in +⌿ that I never got around to fixing. Comparing to ⌈⌿ could be interesting.
 
Ah, right:
     ]runtime -c 3⌈⌿rand (2↓rand)⌈(1↓¯1↓rand)⌈(¯2↓rand) 1↓¯1↓{⌈/⍵}⌺3⊢rand 1↓¯1↓{⌈⌿⍵}⌺3⊢rand

 3⌈⌿rand                        → 1.0E¯3 |       0%
 (2↓rand)⌈(1↓¯1↓rand)⌈(¯2↓rand) → 2.0E¯3 |    +100%
 1↓¯1↓{⌈/⍵}⌺3⊢rand              → 8.3E0  | +829300% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 1↓¯1↓{⌈⌿⍵}⌺3⊢rand              → 8.5E0  | +853800% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
But it's also possible +⌿ is using a suboptimal algorithm like sum-scan then difference, or some pairwise thing that does poorly for the small left argument of 3.
 
12:56 AM
I'll log that +⌿ could be faster.
 
Oh, factor of 10 difference. Probably +⌿ is just not SIMD-optimized at all.
 
in my mind the memory usage is worse than the speed, because it still seems really fast, but you could easily wsfull on larger arguments
 
I'm a bit surprised that {f⌿⍵}⌺n isn't special-cased for scalar f.
 
Note that the first sum happens before starting 2↓rand. So probably max memory usage is like 4×rand where the single-function ones do 2×rand. Running in place is possible but hard.
Or, given that + actually does overflow, everything's more complicated than that. In-place is impossible and the sizes should go up to 5×rand and 3×rand.
 
1:35 AM
@rak1507 I've logged the slow speed as issue 19470
I'll be happy to get any improvements to _NR_←{i←⎕IO-⍨⍳⍺ ⋄ ⊃⍺⍺¨⌿(-⌽i)↓[⍵⍵]¨i↓[⍵⍵]¨⊂⍵}
@user176905 Hi John Jacob. If you want to participate here, simply email access@apl.chat
 
 
1 hour later…
2:51 AM
Hey how do you make a web request?
i see {(⎕SE.SALT.New'HttpCommand'('GET'⍵)).Run.Data}Dv on the aplcart but i dont know how it works
 
3:04 AM
@gamma_delta docs.dyalog.com/latest/Conga%20User%20Guide.pdf this may be helpful
 
3:20 AM
@gamma_delta Do you simply want to fetch the content from a URL, or build a full request with headers and/or data etc?
 
Just fetch but i was more curious than anything
Anyways how might i fold / in 2-pairs over a list?
2// doesn't work and i can't figure out how to add parens or ⊢⍤ to fix it
 
@gamma_delta {(⎕SE.SALT.New'HttpCommand'('GET'⍵)).Run.Data}'example.com' should do the trick.
@gamma_delta Maybe I'm not understanding what you want, 'cause ⎕←2//1 2 3 4 sure seems to work.
 
@Adám
┌─┬───┬─────┐
│2│3 3│4 4 4│
└─┴───┴─────┘
 
Or do you mean to use every other element as repetition factor and every other element as data to be repeated?
That would be ⎕←//⍤⊢⌺(⍪2 2)⊢1 2 3 4
 
@Adám
┌─┬─────┐
│2│4 4 4│
└─┴─────┘
 
3:29 AM
if i try to make a train of it like (2//)
 
Then you need (2//⊢)
 
Because // is a dyadic function, taking 2 as left argument (tine in the fork), so you need to put a right tine in too.
 
ahhhh
 
 
5 hours later…
8:09 AM
A rare treat: Managed to reduce a 190-line/6.9 kB function to 66 lines/2.3 kB while adding plenty of functionality and fixing various issues.
2
 
 
2 hours later…
10:03 AM
@gamma_delta There is a chapter on using HttpCommand in xpqz.github.io/learnapl/http.html in case you want more detail
 
 
2 hours later…
11:44 AM
@Adám nice
 
Sometimes refactoring really pays off.
My only gripe is that I went from two s` to 7 s… We really need that setter/getter functionality.
 
what was the function
 
⎕ED'outputspec.Run'⊣⎕SE.UCMD'uload box'
 
12:37 PM
1
Q: Factorial digit sum in APL . Eulers 20

user17356614+/⍎¨⍕(!8) first I found out this and gave me result as 9 . but if I do 100! as the number is big I am not able to get that. ⍎¨⍕(!100) I am getting syntax error. ⍎SYNTAX ERROR Is there any other way to solve the problem or suggest me some modifications . Thank you

 
12:50 PM
This isn't right, is it?
 
does not look right
 
@PatrickVillela Hi there. Interested in APL?
 
 
7 hours later…
8:01 PM
@RGS Thanks for your help, you're right that I mistakenly used the right argument from the xm example for the xr example. The xm function on the defn page does seem to have a problem though since it should start with ⌈ and not - to work correctly.
 
0
Q: What is a performant algorithm for implementing APL grade up?

John CowanFor APLers: I am only concerned with monadic grade up over vectors. For non-APLers: Grade up is a function that takes a numeric vector V of size n and returns an integer vector R of equal size. The index of the smallest element of V is placed in R[0], the index of the next smallest element in R[...

 
TryAPL is down
 
 
4 hours later…
11:54 PM
  m ← ? 4 4 ⍴0
above expr is not working in GNU-APL, why is that?
 

« first day (1751 days earlier)      last day (911 days later) »