« first day (904 days earlier)      last day (1743 days later) » 

ngn
7:11 AM
@Adám so, the first one is like an ∨\BA1 but confined separately within each stretch of 1s in BA2
⎕←↑BA1 BA2(BA2∧A=⌈\BA1×A←+\BA2>¯1↓0,BA2) ⊣ BA1←0 1 0 0 0 0 0 1 0 0 1 0 0 0 1 ⊣ BA2←0 1 1 1 0 1 1 1 1 0 0 0 1 1 1
 
@ngn
0 1 0 0 0 0 0 1 0 0 1 0 0 0 1
0 1 1 1 0 1 1 1 1 0 0 0 1 1 1
0 1 1 1 0 0 0 1 1 0 0 0 0 0 1
 
ngn
^ the 3 rows are BA1,BA2,result
golfed: BA2\∊∨\¨BA2⊆BA1
the third expression uses this definition: "A saddle point of a matrix is an element which is both the largest element in its column and the smallest element in its row." -W
golfed: ⍉↑⍸(⌊/∘.=⌈⌿)NM
if IS means int scalar, this one makes no sense: (0,⍳(⍴XV)-IS)∘.+IS why the ∘. ?
probably a missing ⍳ after ∘.+
also, it relies on ⎕io←1
golfed: ↑IS,/⍳≢XV
"Number of ?s intersecting ?s". ?s = "intervals" or "segments"
"Repeat matrix" - i can see what it does but i don't understand how it could be useful
 
ngn
7:58 AM
"XV[⍋BV++\BV] Rotate first elements (1⌽) of subvectors of XV indicated by BV." - as it says :) note that a 1 in BV marks the beginning of a subvector (unlike the first finnapl entry in which stretches of 1s were used to highlight whole subvectors)
the rest look boring. the ancient finns didn't have ⍤ and tao.
 
8:53 AM
@ngn Thanks a bunch!
@ngn True, but grade always worked with flat numeric arrays, so I'm a bit lost on "Sorting a matrix"… it was always just NM[⍋NM;].
 
ngn
9:13 AM
@Adám right, they didn't even need tao
⎕←NM[⍋+⌿A<.-⍉A←NM,0;] ⊣ NM←↑(2 0)(1 1)(1.5 1)
 
@ngn
1   1
2   0
1.5 1
 
ngn
^ "Sorting a matrix into lexicographic order." - they were lying
 
@ngn Exactly what I tried (although also with negative numbers) — hence my confusion.
 
ngn
the implicit </ in <.- is wrong
</ works on the vector of differences between two rows, and is supposed to report whether the first non-0 difference d is negative, but it fails when there's a 0<d<1
 
 
1 hour later…
10:51 AM
@ngn I wonder why they didn't use (⌊/NM)∘.=⌈⌿NM.
 
11:02 AM
@ngn What does it do?
 
11:24 AM
@ngn I still don't understand. :-(
 
ngn
11:39 AM
@Adám idk, they probably didn't feel as compelled to golf their code as we do
 
@ngn :-D If you notice anything in APLcart that can be improved, please do let me know. (It is under 2000 entries, after all…)
 
ngn
@Adám hard to describe with english words. it finds the beginning of each group of consecutive identical items in XV1, except that size-1 groups are ignored. then it gets the corresponding elements in XV2 and does ∘.= of them with XV2 itself
 
@ngn That sounds very arbitrary. Must have been needed for some specialised algorithm, half a century ago…
 
ngn
@Adám NV1 and NV2 describe segments on the real line. NV1 are the start points, NV2 are the end points. the expression computes how many of those segments intersect. perhaps it should be +/, instead of +/
 
@ngn Ah, now I get it.
 
ngn
11:45 AM
unless they meant number of intersections by segment (not total)
 
@ngn Right, now many are "active" here.
No, wait, that doesn't make sense.
I'm thinking something like this:
  ⎕←A←1 0 0 1 0 0 1 0 0 ⋄
  ⎕←B←0 1 0 0 0 0 0 1 1 ⋄
  ⎕←+\A-B
 
@Adám
1 0 0 1 0 0 1 0 0
0 1 0 0 0 0 0 1 1
1 0 0 1 1 1 2 1 0
 
ngn
yep, it's wrong
 
@ngn If you have no idea what it should be, I'll just leave it out.
 
ngn
NV1 ←→ start
NV2 ←→ end
A[i;j] ←→ start[i]≤end[j]
(A∧⍉A)[i;j] ←→ (start[i]≤end[j]) ∧ end[i]≤start[j] ←→ segment i is entirely to the left of segment j
 
11:58 AM
@ngn Sure, but what does the result count?
 
ngn
@Adám result[i] is the number of segments that are entirely to the right of segment i
@Adám maybe they wanted A∧~⍉A (a.k.a. A>⍉A). that's wrong only for the edge case of segments intersecting at a single point
 
@ngn Maybe, but again, it seems oddly specific and arbitrary. Not really a common need.
 
ngn
@Adám intersection of segments is not as arbitrary as that other "idiom"
it's probably common in gui toolkit impls
 
@ngn OK, but it's gotta be correct. You have a correct version?
 
ngn
@ngn gosh, did i get this one right... i'm still not sure. need coffee
ok. it looks like i was wrong.
⍉ swaps only the indices i and j. what i did instead was swap start and end, so accidentally i flipped the direction of ≤ too.
@Adám i tested with a small example. the finnapl version is right. note it treats each segment as intersecting with itself.
 

« first day (904 days earlier)      last day (1743 days later) »