« first day (1423 days earlier)      last day (1232 days later) » 

11:03 PM
@Marshall here's a full tutorial. maybe I should make a new room for it.
 
11:21 PM
Is there some kind of "scan until" operator in APL? Or a version of the power operator, but where each result is kept in a list and there's a separate state passed around each time?
 
@user not in regular APL
 
But there are other variants with it?
 
@user dzaima/APL has that's like but gives a list of the results
 
Cool, I'm going to try that out!
 
example (but keep in mind that, just like , it'll always execute the function at least once, so will give a list of at least 2 items)
 
11:23 PM
<moon-child> @user I believe one of the k convergence operators does that
 
I don't know k very well, but I'm going to check that out too, thanks
@dzaima That works for me
 
fwiw this works in regular Dyalog
 
Ah, but that's 6 bytes longer
 
ngn
@DyalogAPL @ moon-child converge (monad/) and converge-iterate (monad\ ) are analogous to over (aka reduce, dyad/) and scan (dyad\ )
\ preserves intermediate results, / doesn't
 
"Mastering Dyalog APL" has probably not been updated yet wrt. ⌸ key operator, right? Can't find it in the table of contents
I _think_ I need it:

datapoint_indexes←⍸json_type=4 ∧ p∊⍸'datapoints' in name
5 6 14 20
nearest_node[datapoint_indexes]
2 2 11 17

now ideally I'd like to group the indexes by their nearest node:
2 (5 6)
11 (14)
17 (20)
I was able to do nearest_node {⍺ ⍵}⌸ (json_type=4 ∧ p∊⍸'datapoints' in name) but that destroys the ability to later
 
11:36 PM
@MartinJaniczek The actual book hasn't been updated since 2009. here's some effort into updating it, but it doesn't mention past its existence
 
Now that I write that and look at the result, I think I can get it back by adding the nearest_node value and some ⍳ to the right-side array...
 
@MartinJaniczek can't quite infer what "ability to later" you want there
 
When I had the full bool vector there, I could do ⍸ and get 5 6 14 20
But the result of Key splits the bool vector into chunks
(I don't understand Key enough to know whether I can do things in a saner way)
 
@MartinJaniczek (you sure you don't need parentheses around json_type=4?)
 
uh oh :D
I think I don't need the json_type=4 at all actually, at least for the data I'm testing the program on. Thanks for the push
 
11:42 PM
@MartinJaniczek my first thought is to first just do {⍺⍵}⌸nearest_node and use that Somehow™ (potentially something like {⍺ ⍵ (something[⍵])}⌸?)
@MartinJaniczek there are 2 ways to use - monadic and dyadic (and F⌸ ⍵ is equal to just ⍵ F⌸ ⍳≢⍵)
 
Looks promising, I'm trying to play with the something to get the right bool vector to show up again next to the right ID numbers. But honestly it might be easier for me to go from the other side with the screenshot I've posted
 
(⌸ docs fwiw)
 
'datapoints' in name what is this, python?!
 
:D blasphemy I know...
equals_string←{(⊂⍺)∊⍨∘⊂⍵}
in←{(⍺ equals_string⊢)¨ ⍵}
I'm sure this is all horribly inefficient
 
@MartinJaniczek equals_string←≡?
in←{(⊂⍺)≡¨⍵}?
 
11:48 PM
.......... how can I even reply to this
you're right
 
@dzaima alternatively, in←{⍺∘≡¨⍵} or in←{⍵∊⊂⍺}
 
⊢∊⊂⍤⊣ or something
 
also your equals_string doesn't need the , at which point the can be removed for {(⊂⍵)∊⊂⍺} which can be golfed to ∊⍥⊂⍨
 
Not a golfer yet. Just mad at myself that I've tried most of stuff around = but didn't think of ≡
 
@MartinJaniczek with = you could've done {≠/≢¨⍺⍵:0 ⋄ ∧/⍺=⍵}
(assuming the args are of equal length, there's even ∧.= but i personally prefer (∧/=) over that)
 
11:53 PM
I like inner product
 
<moon-child> to be rank-polymorphic, you would need multiple reductions. Which could be done with ∧/⍣≡, but that's circular
 
<moon-child> I think the only alternative is recursion
 
moon-child: or just ∧/∘,
(btw instead of images you could post paste (shameless self-advertisement); SE chat has a message length limit, but that can be worked around by using multiline messages, but then SE chat stops allowing markdown sooo)
3
 
11:57 PM
@dzaima thanks I was missing that!
@dzaima Might be worth adding into the room description next to aplcart and other links
 

« first day (1423 days earlier)      last day (1232 days later) »