« first day (1595 days earlier)      last day (1067 days later) » 

RGS
8:14 AM
Does anyone know a nice pattern for doing an outer product between major cells of the arguments?
I have something that works, but doesn't look like the best solution.
 
use rank instead
 
RGS
@rak1507 ooooh
smort
With f⍤¯1 99⍤99 ¯1 ? This works, but looks really long :P
 
No, opposite: f⍤99 ¯1⍤¯1 99
 
RGS
@Adám Opposite to match the ordering ∘.f would give?
 
Yeah.
 
RGS
8:17 AM
cool
 
Another possibility is ∘.,⍥(⊂⍤¯1) optionally with to post-process.
 
beat me to it
 
But depending on what you're doing, it may be less efficient.
 
was literally about to say that, was just checking it worked
 
      a←40 20⍴⎕A ⋄ b←⎕C 30 50⍴⎕A
      ]runtime -c ↑a∘.,⍥(⊂⍤¯1)b "a,⍤99 ¯1⍤¯1 99⊢b"

  ↑a∘.,⍥(⊂⍤¯1)b    → 9.6E¯5 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  a,⍤99 ¯1⍤¯1 99⊢b → 2.9E¯5 | -70% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
      ]runtime -c a∘.,⍥(⊂⍤¯1)b "↓a,⍤99 ¯1⍤¯1 99⊢b"

  a∘.,⍥(⊂⍤¯1)b      → 7.9E¯5 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  ↓a,⍤99 ¯1⍤¯1 99⊢b → 4.9E¯5 | -38% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
So it isn't the final assembly () that kills the native outer product.
 
8:43 AM
@Adám reading that article I'm blown away by the speed comparison of {⊂⍵} vs. ⊢∘⊂ as a left to stencil \_(⍥)_/
 
 
7 hours later…
3:19 PM
@Adám haven't watched the presentation yet (though from the supporting material I'm gathering that it's mostly about @), but as an initial draft... Feedback welcome from all sides!
also note: I've no idea if there even ma be similar primitive in J/K/BQN etc, so I didn't mention those at all
 
RGS
@JosephAdams haven't read the whole thing, but I'll steal borrow some of it when I write about stencil in the MDAPL book :D
 
@RGS You're welcome to :D though I have to admit that, of course, much of the content is taken from the article by Roger Hui and the Dyalog Language doc :p
 
That's fine.
 
3:35 PM
Why is verb train invented?
 
@WongJiaHau You mean why were trains invented?
 
Yes, more specifically, why were they only invented in J but not APL?
 
@WongJiaHau they are in APL, aplwiki.com/wiki/Tacit_programming
 
Oops, sorry my bad
 
3:41 PM
@WongJiaHau They were invented as a parallel to the traditional mathematical notation (f+g)(x) and were actually invented in APL, but first implemented in J.
 
@Adám in that sense can we say that trains are related to distributions?
 
@WongJiaHau You could say that, but it generalises the concept, much like f/ generalises Σ and Π.
 
4:00 PM
@Adám hmm that's something I don't understand (yet) -- could you elaborate how trains (or the like) generalize distributions (of which I recon you're talking about the distributions from stochastics)?
 
@JosephAdams Oh no, I'm taking about functions distributing over other functions: (f+g)(x) ≡ f(x)+g(x)
 
Ahh, sorry then I misunderstood -- so it's the distributive property in arithmetic. Thank you for clarifying!
 
@Adám Interesting, I didn't know this was also an instance of the distributive property
 
@user13999904 Hi Nils Lüschow. Email access@apl.chat if you want to participate here.
 
side note: in the code example immediately prior to here is mentioned (to be used so that a value is printed) but you're assigning to quad instead in the example.
 
4:19 PM
@JosephAdams Fixed. Thanks.
 
4:30 PM
@JosephAdams FYI (you don't have to write it up), Stencil is derived from case 3 of J's Cut (more detailed doc), with modifications. Everything I know of in any other language is more like Windowed Reduce than Stencil, although I don't know K very well.
 
@Marshall yes seems very similar besides having to pad the array ones-self if you want the centering that does -- thanks for the pointer
 
It's actually much older than that, appearing in Rationalized APL and later A Dictionary of APL (search for "tesselations").
 
@JosephAdams Conversely, getting to use the top left corner of the input array as the top left corner of the first window is major work.
 
I guess in that regard J's cut is in fact better :P suppose the major work is figuring out how much larger one has to choose the rectangles so you can chop away the padding
oh, though not quite -- the inner rectangles then are too large too...hmmm does seem quite bad after all
 
You have to pad the input array.
 
4:40 PM
@Marshall s/first link/for this one/ if anyone's reading along
 
Fortunately, McDonnell discusses it a little here, where he claims Rationalized APL is the first appearance. He would know.
@JosephAdams That's right, thanks (just outside the edit window).
 
Luckily, there is plenty of "design space" in to allow specification of starting point. E.g. it could be specified as an offset in a third row of the right operand.
 
 
5 hours later…
9:32 PM
@Adám I most definitely am. I touched on it briefly in school and have since been planning on spending some time learning it in depth. Finally have the time this summer.
I just ordered the Dyalog APL book which Amazon says is coming Monday.
I'll probably start hanging out around here with questions :)
 
in school?!
 
Yes. Took a programming languages class.
Was one of the 'obscure' languages we learned a bit about
 
Ah, cool!
you might be interested in dyalogaplcompetition.com/?goto=welcome
 
Actually just saw that and will definitely be trying out the problems, but I've graduated already so not eligible for the prize (not that I think I have a chance this early into my apl education)

Thanks for sending it though
 
ah, shame, still fun to do the problems though
 
9:40 PM
Ya, I've done the acm contests a few times so looking forward to these problems
 
Use APL to hack into the government and pretend you're in some fake school :P
 
@mo523 they're quite different to regular competitive programming stuff, much more marked on style than speed or accuracy
well, accuracy probably is the number one thing
 
It's the style that drew me to apl
We had a hw to get the avg of a 2d array and that's when it clicked for me. Went from 'what is this "language"' to 'wow'
 
nice
 
My solution was 10 characters (I'm sure it can be done even better) which is worlds cooler than using nested for loops with a bunch of variables.
@Adám btw what made you ping me? Did you just notice I was here and reached out? Just curious
 
9:47 PM
Ooh, I might take a look at this competition. I've written like 3 answers in APL total though :P
 
what was the exact problem? flatten the array and then take the average, or average each row/column?
@mo523 yep
 
I'll look up the problem. Should only take a min
M is the matrix representing the body of the average seasonal temperature. (table shown below)

Chicago 47.8 72.3 55.2 25.0
Houston 68.5 82.3 71.2 54.7
San Francisco 55.5 77.8 59.5 34.4

c) Write a function to determine
iv. Over-all average temperature
@rak1507 Cool beans. Very nice of you
 
I'm not Adám, but that's why he pinged you
 
Thanks. had a feeling that's what you meant
 
here's something fun, the average of a 1d list is (+/÷≢) aplwiki.com/wiki/Tacit_programming
 
9:53 PM
eh, kind of a silly question, but how do i write a matrix as a literal? i tried a bunch of ways but all of them either fail or just give a flat list, i'm a bit confused because i don't remember doing this before :P
 
@hyper-neutrino you don't, either use ⍴ or ↑ like ↑(1 2 3)(4 5 6)(7 8 9)
 
ah. okay
 
proposed new array notation will allow matrix literals (and other cool stuff too)
 
@mo523 you mentioned you had a 10-byter
i got 10 as well with {(+⌿÷≢),⍵}, is this what you had too? :P
 
My solution was this (given my very very limited apl knowledge)
+/+/M÷×/⍴M
Get the sum of the sum of the array (so 2d down to 1d down to a single total)
Divided by the product of the dimensions of the array (so total elements)
ergo: sum/count
@hyper-neutrino lol I don't know what half those symbols do
 
9:57 PM
ooh, this is actually quite interesting given that the array is in a variable
 
@mo523 ah, lol. well it's just sum / length of the matrix flattened into a vector
 
I think the shortest solution is M⌹⍥,M=M
 
(is this what we call a dfn?)
 
yes
(+/÷≢), works too as (f g) is an atop
 
9:59 PM
the simplest solution is probably (+/,M)÷≢,M which is basically what you had, just using , to flatten the array
 
I'm totally lost :)
 
@rak1507 Might not want to show them trains just yet
 
@user no trains there
 
Oops, wrong message
 
@rak1507 is the () necessary?
 
10:00 PM
It's right associative
 
@user ah fair enough I was replying to hyper there
 
{+⌿,⍵÷≢,⍵} seemed to work when i tested on tryapl
 
@hyper-neutrino nice coincidence
 
lol
rip
 
I'll need to come back to this once I actually start learning apl
 
10:01 PM
@mo523 Indeed. I do that, as some feel too intimidated to chat.
 
if your array is (a b c), that's +/(a÷3) (b÷3) (c÷3), which is correct, but it's not the same as (+/a b c)÷3
 
ah wait, this is sum(flat(matrix / len(flat(matrix)))) isn't it?
instead of sum(flat(matrix)) / len(flat(matrix)) like intended?
 
yea
 
Very much appreciated. Though it was more just checking out the community that I hope to join soon than intimidation.

As an aside, is there any way I can pm you?
 
@mo523 On Stack Exchange, all messages are public, but you can email me: adam@ with the domain of www.dyalog.com
 
10:06 PM
Cool thanks will do
 

« first day (1595 days earlier)      last day (1067 days later) »