Let me know if any of this isn't clear (or if I've made
an error).
On your offer to help me understand, I am writing this mail....
Here's an approach that better follows the pattern for join:
join1=:4 :0
bX=. (kX=. {."1 x) </. x
bY=. (kY=. {."1 y) </. y
j1=. (0 # {.)&.>
j2=. ([: ,/ ,"1/)&.>/
;-.&a:,(kX,&~.kY) j2/[EMAIL PROTECTED](2>#)/.bX,bY
)
To understand the last statement, I have to first figure out how to
break the train of verbs there. And before that to understand what j1
& j2 are supposed to do. Here are my current findings....
1) j1 using the &. operator unboxes and reboxes after applying the verb
j11 =. (0#{.)
What is the purpose of j11? I understand it as erasing the content.
2) j2, I figured out as obtaining the cartesian product of the boxed
values. How does it do this?
3) Then the train
j=. j2/[EMAIL PROTECTED](2>#)/.
Here I donot understand what /` does. Overall, I am lost
4) And the prefix train has me completely puzzled.
p =. ;-.&a:,
5) The challenge for me here is that there is a movement across the
various dimensions along with boxing and unboxing that makes it hard
for me to follow what is the logic you are trying to express. I am
still learning and so am not able to read off the algorithm as stated
in the J language. Some tips on how I can parse such statements into
algorithmic steps would help (apart from experience in reading the
language.:))!
6) Finally, you mention that the previous posting is inefficient due
to O(n^2). How did you conclude that? Further, I find (as stated in 2
above) that there is a cartesian product involved in the current
construction. Would that not cause a similar concern in this approach?
Thanks for your time!
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm