« first day (2029 days earlier)      last day (618 days later) » 

1:08 AM
@AviFS from IBM?
 
 
4 hours later…
4:58 AM
@AviFS with that you're just timing Go's bigint impl
 
@dzaima Yeah, I figured the bigint bit wasn't the interesting part, though I didn't realize it was just a stdlib. But I was still impressed with the speed, and just curious how well a, presumably relatively naive, implementation in Go stacks up against Dyalog's meticulous optimizations.
@LdBeth Possible! Do you know the paper?
It has little drawings, that's probably the key identifier.
 
@rak1507 seems that takes about the same time as */1+i. 10000x (both taking ~190ms), so noone's bothered optimizing factorial specifically. dzaima/APL takes ~30ms for both, but a simple recursive solution goes down to 3.6ms
@AviFS could look through this
 
It was "APL - A Glimpse of Heaven." I finally found it by remember that it was Bernard Legrand. (Same guy who wrote the Mastering Dyalog APL book.)
@dzaima Interestingly, it's not there.
 
yeah, it's not particularly complete
 
@dzaima I know. That's where I come in :p
Does anyone else think it's well-written? It was hard to find! It's the paper that got me into APL.
I don't even know if I'd like it now, but I clearly liked it then.
@dzaima I actually tried the same thing with the Go implementation! Also seems to be the same amount of time, though I didn't time it precisely. I didn't think there was an optimization for factorial, is there?
 
5:19 AM
@AviFS it seems to just invoke the stdlib
..and that seems to do what my dzaima/APL recursive solution does - split into halves recursively
 
Interesting, there actually are clever factorial algorithms, but I got no results for "factorial algorithm" on the first page of Google, except for two CS.StackExchange threads. Here's one, with a nice answer.
The complexities are bollocks, though. Naively, you evidently get O(n^2 log n). Optimized, you can get
O(n(log n)^3 log log n).
I think that's the most complex complexity I've ever seen in the wild.
@dzaima Ah yeah, funny that I didn't get any top hits for that on Google. It comes up in the Stack Exchange answers, but it looks like the best algorithms are more efficient still.
@dzaima Do these... methods work for reducing any array, though? Or do they make use of the fact that they're 1-n.
 
the recursive splitting should work for any associative function on any array
 
I mean like that particular technique should just be an improvement over any reduction. I wonder if there are any algorithms that actually take advantage of the properties of a factorial.
@dzaima Good point on the associativity!
 
 
3 hours later…
8:43 AM
how do I make a table of paired strings in J?
In APL I just do `'chsd'∘.,'A23456'` and it works, but the (what I thought was) equivalent J code `'chsd' ,/ 'A23456'` doesn't work. The NuVoc says it's due to the rank not being 0, however, setting the rank to 0 by doing `,"0/` produces a 4 6 2 matrix, rather than the expected 4 6 matrix
any insight?
ah, it's probably because the results aren't boxed, J doesn't support nested iirc
yeah, fixed it: <"1 'chsd' ,"0/ 'A23456'
 
Interesting
I didn't know there was an each keyword
   <"1 'chsd' ,"0/ 'A23456'
┌──┬──┬──┬──┬──┬──┐
│cA│c2│c3│c4│c5│c6│
├──┼──┼──┼──┼──┼──┤
│hA│h2│h3│h4│h5│h6│
├──┼──┼──┼──┼──┼──┤
│sA│s2│s3│s4│s5│s6│
├──┼──┼──┼──┼──┼──┤
│dA│d2│d3│d4│d5│d6│
└──┴──┴──┴──┴──┴──┘
that produced the desired effect however ^
 
 
3 hours later…
11:58 AM
@ElectricCoffee Indeed. 'chsd' ,each/ 'A23456' does the trick.
 
 
2 hours later…
2:21 PM
Just a few votes necessary to get us in the top 2 for the next round!
https://week.golf/newLanguage.php
 
 
1 hour later…
3:48 PM
what is the difference between ⊆ and ⊂ used monadically?
 
⋄ ⊆ 'this' 'that'
 
@Richard
┌────┬────┐
│this│that│
└────┴────┘
 
nvm, basic thing is that ⊆ doesn't increase depth if its argument is already nested whereas ⊂ does.
thanks @Rich
 
⋄ ⊂ 'this' 'that'
 
@Richard
┌───────────┐
│┌────┬────┐│
││this│that││
│└────┴────┘│
└───────────┘
 
4:01 PM
how keen are people for an emacs major mode that is as feature complete as RIDE? On one hand, I'd bet that you can do all the stuff you'd need to do by using org-babel + the jupyter kernel; debugging can be done printf style methinks, just put stuff like {##.debug,←f ⍵} for suitable f. OTOH, interactive debugging is a lot more fun once you get used to it I'd imagine.
 
 
2 hours later…
5:49 PM
hi guys. in the try apl example for computing average avg←{(+⌿⍵)÷≢⍵}

why is ⌿ used instead of /. they seem to offer the same results
 
@M4X_ ≢counts sub-arrays along the first axis, so the mean should count elements along that axis. To give a concrete example in 2D consider: ⋄M←3 4⍴⍳12
 
@11Kilobytes Response looks like a 0-by-0 matrix.
 
hmm, let's try that again:
⊢M←3 4⍴⍳12
⋄⊢M←3 4⍴⍳12
 
@11Kilobytes
1  2  3  4
5  6  7  8
9 10 11 12
 
Now: ⎕←≢M
 
6:00 PM
@11Kilobytes
VALUE ERROR: Undefined name: M
      ⎕←≢M
       ∧
 
Now observe that ≢the number of rowsb.c. that's the first axis; so that you get 3 instead of 4 in: ⎕←≢3 4⍴⍳12.
 
@11Kilobytes 3
 
Observe that in aligment with this +⌿ takes the sum along each column: ⎕←+⌿3 4⍴⍳12
 
@11Kilobytes 15 18 21 24
 
Never mind, it seems I made a mistake. Perhaps it is better to say avg←+/÷≢. :D
 
6:10 PM
okay
so its suppossed to be avg←{(+/⍵)÷≢⍵} not avg←{(+⌿⍵)÷≢⍵}
 
not exactly sure though, like i'm thinking about the n dimensional case @M4X_
 
Am new to APL
 
@M4X_ nah. Actually the standard avg←{(+⌿⍵)÷≢⍵ is correct because you have to divide by the number of elements that you add up - not something like "the number of averages you are calculating."
Consider again our example ⎕←3 4⍴⍳12.
 
@11Kilobytes
1  2  3  4
5  6  7  8
9 10 11 12
 
Notice that ≢counts the number of rows. ⎕←≢3 4⍴⍳12.
 
6:23 PM
@11Kilobytes 3
 
That means that it is the thing you divide by when you want to calculate the average of each column not each row. So let's look at e.g. ⎕←{(+⌿⍵)÷≢⍵}3 4⍴⍳12.
 
@11Kilobytes 5 6 7 8
 
thanks for the clarification
 
This is a four element array (same as the number of columns), and you can see that e.g. the first element is (+⌿1 5 9)÷3 ←→15÷3 ←→ 5.
@M4X_ welcome, sorry if I was too confused at first. Have a poor diet and drank too much coffee. Anyway have you heard of trains, they allow you to be even more concise in such cases and write avg←+⌿÷≢ for example. Click through on that link if you are curious.
 
7:10 PM
@11Kilobytes If you edit your message, the bot will also edit its response.
 
7:21 PM
@Adám thanks for the info.
 

« first day (2029 days earlier)      last day (618 days later) »