« first day (2305 days earlier)      last day (643 days later) » 

02:43
@Adám no, i did not.
i could make one, if that's a thing people want.
 
3 hours later…
05:53
@Razetime Right, sorry; bad memory. It was AviFS and for RIDE schemes. I made a plugin for the Windows IDE such that the schemes are kept in text files, making them easy to share, but I'm not sure how much value there is in rendering/editing them outside the IDE.
 
9 hours later…
15:00
Welcome to APL Quest 2019-8! Today's quest is Going the Distance:
> Given a vector of (X Y) points, or a single X Y point, determine the total distance covered when travelling in a straight line from the first point to the next one, and so on until the last point, then returning directly back to the start. For example, given the points (A B C) ← (¯1.5 ¯1.5)(1.5 2.5)(1.5 ¯1.5), the distance A to B is 5, B to C is 4 and C back to A is 3, for a total of 12.
{+/{((2*⍨⊃⍵)+2*⍨⊃⌽⍵)*0.5}¨2-/⍵,⊂⊃⍵}
That looks quite involved.
yes it does
but the main part is squaring and root
> (2*⍨⊃⍵)+2*⍨⊃⌽⍵
isn't that +⌿2*⍨⍵ ?
{((2*⍨⊃⍵)+2*⍨⊃⌽⍵)*0.5}¨ is basically {((2*⍨⍺)+2*⍨⍵)*0.5} inserted into each pair.
@Silas Yes it is, which is what I was getting at.
15:04
:)
{((2*⍨⍺)+2*⍨⍵)*0.5} is {(+/2*⍨⍺ ⍵)*0.5}
But since we want to take both on the right, it is simply {(+/2*⍨⍵)*0.5}
so +/⍢2*⍨ ?
It'd be +/⍢(*∘2) or +/⍢(×⍨)
yeah, no hyper-operators
How would that work?
@Richard Less awkward than 2-/⍵,⊂⊃⍵ is ⍵-1⌽⍵
15:08
ah, was thinking the under would take the 2*⍨ as ⍵⍵ but you can't do that as operators can't take operators. Or would that be a derived function?
2*⍨ isn't anything.
So, now Richard's solution is down to {+/{(+/2*⍨⍵)*0.5}¨⍵-1⌽⍵}
We can straighten out the inner dfn to {+/{0.5*⍨+/⍵*2}¨⍵-1⌽⍵}
better!
+/⍵*2 is the same as +.×⍨⍵ giving us {+/{0.5*⍨+.×⍨⍵}¨⍵-1⌽⍵}
Now it should be trivial to make the inner dfn tacit: {+/(0.5*⍨+.×⍨)¨⍵-1⌽⍵}
But note that this is an atop where the post-processing function 0.5*⍨ is a scalar function; no need to include that in the Each: {+/0.5*⍨+.×⍨¨⍵-1⌽⍵}
@Adám why don't you need to bind the 0.5 here?
It is an Agh fork: 0.5 *⍨ +.×⍨
15:16
right - thought so, but all the ⍨'s looked like you'd need one
We can combine +.×⍨¨ with - as an explicit atop: {+/0.5*⍨⍵+.×⍨¨⍤-1⌽⍵}
This is a preparation step for going all tacit: +/0.5*⍨⊢+.×⍨¨⍤-1∘⌽
For show-off, we can combine +/0.5*⍨ into yet another inner product: 0.5+.*⍨⊢+.×⍨¨⍤-1∘⌽
I don't like non-integers: 2+.*∘÷⍨⊢+.×⍨¨⍤-1∘⌽
Nice solution, @Richard!
@Adám If you rewrite it like you did :)
I had a very similar one: 2+.*∘÷⍨2+.*¨⍨⊢-1∘⌽
This one is interesting in that we see the symmetry between 2+.*∘÷⍨ and 2+.*¨⍨
Because of the ¨ we couldn't just write this as an under.
Could you mix the vector at the start to help with that?
I was just about to try that.
Beautiful: 2+.*∘÷⍨2+.*⍨↑-1⊖↑
It does mix twice, but looks better for it.
15:26
Are you going to do this step by step in the video?
Ah, I'd gotten to {+⌿.5*⍨+/2*⍨(⊢-1∘⊖)↑⍵}
@Richard I probably should, shouldn't I?
@Silas That's the same, just more readable :-)
so it is - thought your double mix was slightly different but just slight manipulation
@Adám I would appreciate that because it has some nice steps in it
+/↑+/⍢(×⍨)⍤-1⊖↑
15:31
Beautiful! Test data for this just random points right? Thinking of seeing just how much the inner products speed things up
Alternative: +/1⊥⍤1⍢(×⍨)↑-1⊖↑ or even 1⊥1⊥⍤1⍢(×⍨)↑-1⊖↑ for lots of 1s :-)
1⊥⍣2 on the front?
No, the ⊥⍤1 is the operand to
Hey, remember this idea I had that if we add where monadic is 2√ then we should also add a power function ↖←*⍨ where monadic is 2↖?
Didn't know you had an idea for a glyph but yeah?
Nah, the glyph isn't set in stone. Just had to find something fitting now.
15:34
And this one also works for 3D!
+/↑+/⍢↖⍤-1⊖↑
Doesn't the previous? Thought you're reversing the inital list then doing the pythagoras
Sure, but Richard's original doesn't work in 3D because of and ⊃⌽
@Adám exactly
ah! Thought that was a comment on the ⌽ vs ⊖ approach
15:37
I like this mixed version. Shows how much better it is to stay flat.
Roger Hui supported adding ⊕←{⍺+¯11○⍵} or ⊕←{⍺+0J1×⍵} if you want.
Then (10+.○⊢-1⌽⊢)⊕/¨ solves the problem.
10○ is monadic | so alternatively: (+/⊢|⍤-1⌽⊢)⊕/¨
Ooh: +/1(|⊢-⌽)⊕/¨
+/1(|⊢-⌽)⊃¨+¯11○⊃⍤⌽¨) isn't nearly as nice, but +/1(|⊢-⌽){⍺+¯11○⍵}/¨ does work.
Of course, these are strictly 2D.
with quaternians for the 3D and 4D cases? :D
And octonions, then sedenion, but what will you do in 17D space‽
15:52
well 15= ∞ so nothing...
Nope, that's dimensionality of arrays/tensors. Here, we're just talking vectors of length≥17.
it is dead, isn't it?
with some useful things this week - your (⊢f⌽) looks like good starting point
 
3 hours later…
18:41
@Adám couldn't make it (as guessed), here was mine: +/*∘.5⍤+.×⍨⍤-/⍨∘2⍤(⊢,1∘⌷)

« first day (2305 days earlier)      last day (643 days later) »