
From:  Elias Mårtenson 
Subject:  Re: Inner join vs. outer join 
Date:  Tue, 14 Apr 2020 18:05:18 +0800 
s/join/product/ ?In APL's inner product (X a.b Y), each item of the result corresponds to a row of X combined in some way with a column of Y. So the shape of the result is (¯1↓⍴X),(1↓⍴Y).In APL's outer product (X ∘.b Y), each item of the result corresponds to an item of X combined in some way with an item of Y. So the shape of the result is (⍴X),(⍴Y).J probably does this in a more generic way, and you can certainly implement inner and outer products and variations thereof by using the Rank operator. For example:X (b⍤99⍤0 99) Y ⍝ implements X ∘.b Y (where 99 is an approximation to infinity)X({+⌿⍺(×⍤¯1)⍵}⍤1 99)Y ⍝ implements X +.× YJay.On Tue, 14 Apr 2020 at 05:07, Elias Mårtenson <address@hidden> wrote:I was reading the spec on outer join to see if I could finally fully understand how it works.For reference, the spec refers to the syntax as follows:X a.b YThe function a is referenced twice in the description for this function, both times in the form a/ (i.e. with the reduce operator applied).I then noted that the J version of this function does not apply the reduce operator. I.e. in J, you have to do:X a/.b YNow, am I correct in my assumption that with this change, there would be no need for the ∘ (null function)? I.e. if APL behaved like J, would the following achieve an outer join?X ⊣.× YI'm still not sure I fully understand the join operator to the point where I can answer this question.Regards,Elias
[Prev in Thread]  Current Thread  [Next in Thread] 