« first day (1997 days earlier)      last day (650 days later) » 

 
5 hours later…
5:39 AM
Adám, these videos are seriously excellent. I've learned so much just from watching them, pausing every time you arrive at a full function, and trying to reconstruct it from memory. Thanks so much for your work.
 
 
3 hours later…
8:29 AM
@Adám Shouldn't the recurrence formula have p & q, rather than p & p?
 
Ouch.
How do I fix this now?
 
No biggie -- your voice-over makes it clear. Although maybe it's possible to add graphical annotations? "<------- should be a q, not a p" kind of overlay.
 
Nah, YT doesn't allow that any more.
 
 
2 hours later…
Did you re-record the whole thing?
 
No, I edited the video, overlaying an image. Causes my face video to disappear for those parts, but that's OK, because it was anyway slightly on top of the sequence.
 
10:59 AM
For anyone interested: a youtuber who covers esolangs / other lesser known languages used on code golf has made a video on APL:
Turns out I've been misled
I'm sorry but it seems that the video was someone's attempt at a joke
Apologies for the inconvenience
 
I mean, it is about APL (the programming language), and makes only true claims about it.
 
As I said, I didn't realise the video was a bait and switch video, so apologies for the messages
 
@user16044228 Hi Photon Niko. If you want to participate here, please email access@apl.chat
@milkwood1 Hi there. Interested in APL?
 
11:33 AM
CMP: How do you pronounce ⍺⍺?
 
aaaaalfa
 
Suggestion: alfalfa
But then ⍵⍵ would be… omegomega or omegamega?
 
How about alfas and omegas
 
Not distinct enough from plain and methinks.
 
I know... wait for it... left and right operand.
 
11:42 AM
Too long.
 
Leper and Roper
Loper Roper
 
alfafa omegaga
 
I like that.
 
@Adám Very nice video again btw! You found some realy nice solutions afterwards.
 
I don't think I added anything particularly new, only polished the chat solutions a bit.
 
11:50 AM
The only thing missing was a final step of the power version with an external accumulator to show that it could also be fast, or stretch to 1000.
But the video was already getting long.
 
can't remember Q
 
@xpqz Did that actually get fast?
 
Or do I discredit someone now?
 
Q?
 
@Adám Yes, I believe @dzaima made a fast one.
 
11:52 AM
We could also have done a tail-recursive version.
Oh, I see, I missed that when collecting solutions for the video:
Jul 8 at 16:01, by dzaima
here's an APL one with an explicit accululator - {r←↑(0 1)(1 ⍵)↑⍨2⌊1+⍵ ⋄ r ⊣ {(a b c d)←,¯2↑r ⋄ r⍪←a b-⍨c d×⌊d÷⍨⍵+b ⋄ ⍵}⍣{≥/⊢⌿r}⍣(1<⍵)⊢⍵}
Still didn't come close to the other fast solutions.
 
It will at least run to 1000 without dying.
 
:61589107 Q←{(,÷∨)∘1¨{⍵[⍋⍵]}0,∪1⌊,∘.÷⍨⍳⍵}
 
Jul 8 at 15:02, by Adám
I've got {(,÷∨)∘1¨{⍵[⍋⍵]}0,∪1⌊,∘.÷⍨⍳⍵}
@xpqz Not really:
  Pf⊢100 → 1.1E¯2 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  Pe⊢100 → 9.6E¯3 | -10% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
Takes a second on my machine for 1000
Pf takes 10 seconds, so yeah.
But Qf takes 0.1 s.
 
That's the interesting lesson, I think. Power is costly copying its argument between iterations as the argument gets larger.
A tail-recursive formulation without an external accumulator would suffer similarly.
 
Yeah. Odd.
But yes, I think I can excuse myself for leaving it out, as the approach is otherwise very similar to the other -based ones, and the video was pretty long.
@hyper-neutrino Can you give chat.stackexchange.com/users/553236/user16044228 access?
 
12:03 PM
I guess it's pass-by-copy. So for each iteration it has to reclaim the old, and reallocate a new, larger one.
 
Strange that it can't optimise that to be in-place.
 
Yes -- because it's by definition the same thing.
 
12:19 PM
      ]runtime -c "{⍵,1}⍣1000000⊢⍬" ",∘1⍣1000000⊢⍬"

  {⍵,1}⍣1000000⊢⍬ → 6.0E0  |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  ,∘1⍣1000000⊢⍬   → 7.8E¯2 | -99% ⎕
I think dyalog just doesn't support using the last reference to as an owned reference
(what if the concatenation resulted in an error? (e.g. mismatched shape, WS FULL) You'd get thrown into the debugger, and would have to be able to use , but, were the , able to consume it, it might be freed/mutated)
 
1:00 PM
What does cbqn and dzaima/apl do in this case?
 
It is a documented feature of ⎕FIX that if the argument is a file name (file://...) then the editor will save changes back to the source file?
I could have sworn it was, but reading the ⎕FIX page I don't see anything about it.
 
@xpqz dzaima/APL doesn't ever do in-place stuff, it's java; CBQN does allow reusing 𝕩
 
@PaulMansour Huh, indeed.
 
@dzaima (which my CBQN solution does utilize - the 𝕩∾< part being ⍵,⊂)
 
@PaulMansour Logged as issue 19944.
 
1:14 PM
@Adám Thanks - I'm wondering if it SHOULD actually be undocumented. What is the relationship between this feature of ⎕FIX and Link? Does Link use this mechanism, or is it a vestige of SALT?
 
It is exactly what Link relies on, but SALT doesn't. Basically one of the reasons to rewrite SALT into Link.
 
1:27 PM
Ah, Ok.
 
@Adám done
 
Thanks.
 
2:02 PM
hello, i'm calico
Apparently I am not reputable enough to be able to show my profile picture or username
@lyxal I am the one who created this video lol
I didn't think it would fool anyone, let alone get posted here
 
You user name and avatar will update after you chat for a while.
Since you're new to Stack Exchange chat, I highly recommend reading apl.wiki/APL_Orchard#Features
 
2:24 PM
ahh okay
ohh is that thing on the right people whos joined the chat room
 
2:57 PM
@lyxal you got trolled lmao
 
Welcome to APL Quest 2015-4! Today's quest is PDI - Progressive Dyadic Iota:
> Progressive dyadic iota is similar to except that it returns the index of subsequent matches in the left argument until they are exhausted. Write a function that implements progressive dyadic iota.
This is very much an APL classic.
 
APLcart: {((⍴⍺)⍴⍋⍋⍺,⍵)⍳(⍴⍵)⍴⍋⍋⍵,⍺}
 
Yup.
 
It's got a pleasing symmetry.
 
I failed. COuldn't get a good solution
 
3:02 PM
      ↑'abcabc',⍥⊂'abracadabra'PDI'abcabc'
a b c a b  c
1 2 5 4 9 12
      ↑'abracadabra',⍥⊂1 2 5 4 9 12@1 2 5 4 9 12⊢12⍴''
a b r a c ada b ra
1 2   4 5     9    12
 
@Richard I think if you can derive the APLCart solution unaided, you're already pretty accomplished at APL. The problem here is that this is so well known it's hard not to have it "spoiled".
 
There are actually a couple of ways of stating it.
@xpqz Wait, what?
That's not what's on APLcart as of late.
Indeed, it fails on high-rank arguments:
      'abracadabra'{((⍴⍺)⍴⍋⍋⍺,⍵)⍳(⍴⍵)⍴⍋⍋⍵,⍺}'abcabc'
1 2 5 4 9 12
      'abracadabra'{((⍴⍺)⍴⍋⍋⍺,⍵)⍳(⍴⍵)⍴⍋⍋⍵,⍺}⍥⍪'abcabc'
LENGTH ERROR
      'abracadabra'{((⍴⍺)⍴⍋⍋⍺,⍵)⍳(⍴⍵)⍴⍋⍋⍵,⍺}⍥⍪'abcabc'
                                         ∧
The problem is that, as xpqr stated it, it uses last-axis concatenation. If it used instead of , it'd work.
@xpqz Well, a loopy solution doesn't sound too hard.
Furthermore, it uses monadic instead of monadic :
      'abracadabra'{((⍴⍺)⍴⍋⍋⍺⍪⍵)⍳(⍴⍵)⍴⍋⍋⍵⍪⍺}⍥(2/⍪)'abcabc'
1 12 12 12 12 12
 
I think the LearnAPL bit for this is broken, btw.
 
      'abracadabra'{((≢⍺)⍴⍋⍋⍺⍪⍵)⍳(≢⍵)⍴⍋⍋⍵⍪⍺}⍥(2/⍪)'abcabc'
1 2 5 4 9 12
 
problems.tryapl.org/psets/… ← I get an error whatever I type.
 
3:10 PM
Huh, let me have a quick look.
 
Internal error – No result was provided when the context expected one
 
Yeah, I see it.
 
I started with this
'dyalog apl' {⍸⍵∘.⍷⍺} 'aaalllb'
and also tried something with the key operator
'{⍺⍵}⌸'dyalog apl'
But both were completely the wrong track.
 
I don't think that's completely wrong.
@xpqz Very strange. I don't immediately spot any issues there.
@Richard If you pair up indices for each unique element in the right argument, in the left argument…
 
ovs
My quick attempt of doing it myself:
{(1+≢⍺)@(0∘=)⊢/¨{⍵[⍋⍵]}↓⊃⍪/{⊂⍵,⍥⍪(≢⍵)↑⍸⍺}⌸⍵∘.=⍺}
 
3:19 PM
@ovs Could you explain it to me?
 
Here's mine starting off Richard's track: {t←{⍺⍵}⌸⍺ ⋄ (1+≢⍺)@(~×)⊃{⍵[⍋⍺]}/↓⍉↑⊃,/{⊂⍵,¨(≢⍵)↑⊃t[t[;1]⍳⍺;2]}⌸⍵}
Ooh, how do you like this loopy solution? ⎕←'abracadabra' {+\{a↓⍨←a⍳⍵}¨⍵⊣a←⍺} 'abcabc'
 
@Adám 1 2 5 6 9 12
 
Wouldn't it be nice if it worked? It doesn't, of course. My bad.
 
:)
 
But something like that should be possible.
 
3:26 PM
What kind of loop do you mean?
 
ovs
@Richard The main idea is that each unique row in the equality table represents a different unique value in the right argument. The ones indicate the indices where the value can be found in the lookup string, and the number of times it appeared in the right argument (≢⍺ in the operand of Key) tells us how many of these indices we need. Then we pair up these indices with the locations where they have to be appear in the output and construct the output by sorting.
Because overtaking produces 0's instead of length+1 for missing values, the @ replaces those
 
@Richard each ¨
 
@ovs thanks! Is going to be my homework
 
Nasty:
      'abracadabra'{{i⊣a[i←⍵⍳⍨¯1↓a]←n}¨⍵⊣a←⍺,n←⎕NS⍬}'abcabc'
1 2 5 4 9 12
@Richard That sounds like an explanation for mine too.
 
@Adám what's with the namespace there?
 
3:29 PM
A value that will never match anything else.
 
cunning.
 
So I basically blot out elements as they are used.
My -based solution generates a table of contents t for , then for every unique value in and its indices, pairs up each index with the corresponding index in the -ToC. Then we sort them back into their original locations and replace 0s with 1+≢s.
 
@Adám thanks
 
@Richard Do you understand my ⎕NS solution?
 
no, sorry
 
3:34 PM
No worries. It is maybe the simplest.
n←⎕NS⍬ is a value that doesn't equal anything else than itself.
We start by taking a copy of , but with one "overflow" element added. We loop over the elements of . For each one, we use regular to find the first location in a, ignoring the added element. Once found, we blot out that element as being used, by overwriting it with n (which doesn't match anything else). If it wasn't found, we overwrite the added element, with no actual effect. Finally, we return that element's found index, and proceed to the next.
 
:) smart!
 
@xpqz This is the traditional solution. But there's also a traditional alternative:
{((⍴⍺)⍴⍋⍋⍺,⍵)⍳(⍴⍵)⍴⍋⍋⍵,⍺} ⍝ as quoted by xpqr
{((⍋⍺⍳⍺,⍵)⍳⍳⍴⍺)⍳(⍋⍺⍳⍵,⍺)⍳⍳⍴⍵} ⍝ alternative
Both can be adapted to higher ranks:
{((≢⍺)⍴⍋⍋⍺⍪⍵)⍳(≢⍵)⍴⍋⍋⍵⍪⍺}
{((⍋⍺⍳⍺⍪⍵)⍳⍳≢⍺)⍳(⍋⍺⍳⍵⍪⍺)⍳⍳≢⍵}
But the shorter one is faster too:
      s←⎕A[?1e6⍴26] ⋄ t←⎕A[?1e6⍴26] ⋄ cmpx's X t' 's Y t' ⍝ same length and distribution
  s X t → 1.9E¯2 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  s Y t → 2.2E¯2 | +15% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
      s←⎕A[?1e6⍴10] ⋄ cmpx's X t' 's Y t' ⍝ lots of missing elements
  s X t → 1.5E¯2 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  s Y t → 2.2E¯2 | +44% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
      s←⎕A[?1e3⍴26] ⋄ cmpx's X t' 's Y t' ⍝ short haystack
  s X t → 1.7E¯2 |  0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
@hyper-neutrino Can you give chat.stackexchange.com/users/538234/user110569 access?
@user110569 Hi Steve Allen. I'm getting you access to chat here.
Explanation for the traditional formulation is available in writing and as a video.
APLcart's current formulation is just a condensed version thanks to Over: {⍺(R⍨⍳R←≢⍤⊢⍴∘⍋∘⍋⍺⍳⍪⍨)⍵}
So, for the video for this event, should I bother explaining the traditional one, instead of just linking to it?
I can explain how to get from {((≢⍺)⍴⍋⍋⍺⍪⍵)⍳(≢⍵)⍴⍋⍋⍵⍪⍺} to {⍺(R⍨⍳R←≢⍤⊢⍴∘⍋∘⍋⍺⍳⍪⍨)⍵}.
Um, the short version isn't thanks to Over, but thanks to a fork, of course.
 
3:52 PM
Up to you Adám. You are doing all the effort. At least mention the link in your video and I'l be fine
 
OK, then I think I'll spend the effort on explaining the alternatives we came up with.
Oh, and Richard, I'd love to eventually hear from you if your project of understanding the -based solutions bore fruit.
 
Tomorrow I will be sitting in a bus for 14 hours :). What I normally do to figure it out is decomposite it to the parts I do understand and than slowly rebuild and play with it.
So, yes I have some spare time!
 
@Adám the traditional version is explained already in many places, so stick to the new ones, I'd agree
 
OK. Deal. Any last notes before we part ways until next week's He’s so mean, he has no standard deviation?
Oh, actually, anyone has a great idea for an emoji to represent this week's quest?
(I've begun adding thumbnails to the Quest videos, each one with an emoji that somehow is connected to the task.)
 
A christmas tree for grade-up
 
4:02 PM
Hm, but that just goes on the glyph, not the task.
I was thinking 💺 for seat allocation.
 
That's rather subtle
But why not
 
Perfect Adám.

I probably won't be there next week. Thanks everybody
 
@xpqz See video here.
Wait, there's a Cultivation too.
 
Indeed.
@Adám after this video shows, I can link to it from the cultivation
 
Sure.
 
4:10 PM
I see the cultivation uses the formulation I had; must have been where I got it from, rather than APLCart
 
 
1 hour later…
5:11 PM
@Adám done
 
 
1 hour later…
6:25 PM
Hi! I'm steve_allen in The APL Farm on Discord.
 
Hi and welcome! Since you're new to Stack Exchange chat, I highly recommend reading apl.wiki/APL_Orchard#Features.
 
6:49 PM
Thank you, I will do that.
 
7:03 PM
@user110569 hello, and welcome
It’s just like Discord, but with better signal to noise ratio
 
7:53 PM
I had ⍳⍥(↓⊢,⍤0(((∊{⊂⍳≢⍵}⌸)⍨∘⊂⍋∘⍋)⍳⍨))
 

« first day (1997 days earlier)      last day (650 days later) »