« first day (2354 days earlier)      last day (518 days later) » 

10:40
I think I've found a bug. How do I post a tradfn?
Line 1 gets a SYNTAX ERROR. If I comment lines 2 and 4 everything is fine (and the color changes from angry red to pleasant pink).

Are you not allowed to place a :Section directly below a :Trap?
The manual says that "Sections have no effect on the execution of the code, but must follow the nesting rules of other control structures."

Is this is a nesting violation?
I'm on 16.0.45219.0 32 Classic
11:08
@mappo No, and it works fine by my, admittedly on a newer system.
11:44
thanks, @Adám - good to know
 
3 hours later…
15:00
Welcome to APL Quest 2020-5! Today's quest is Stepping in the Proper Direction:
> Write a function that, given a right argument of 2 integers, returns a vector of the integers from the first element of the right argument to the second, inclusively.
You can actually "cheat" with this one.
I have no decent solution...
I hoped something like this would work:
{(⍺ ⍵)←(⍺>⍵)⌽⍺ ⍵⋄1-⍨⍺+⍳1+⍵-⍺}
We should mention this one:
Jul 1 at 8:20, by RubenVerg
{⌽⍣(>/⍵)(⊢,(⍳|-/⍵)+⊢)⌊/⍵}
>/{⌽⍣⍺⊢⍵}(⌊/,⌊/+(⍳|⍤(-/)))
@Richard You're not allowed to assign to and .
I had +\⊣/,∘(|⍴×)-⍨/
but ⍺←⍵ works
@rabbitgrowth Wow, that's short.
@Richard Special syntax for providing a default left arg.
15:01
@Adám dfns.iotag?
Yes, or just to
@rabbitgrowth Want to explain? It is so clever.
@Richard Do you have a working version ready?
no
don't want to use long conditional statements for swapping ⍺ and ⍵
You can just do (a w)←(>/⍵)⌽⍵
as Ruben did, yes
not exactly
My own reversing version is {(⌊/⍵)+⌽⍣(>/⍵)⊢0,⍳|-/⍵}
15:09
@Adám It was inspired by how +\n⍴1 is the same as ⍳n
Nice insight.
How about direct computation? ⊃+(¯1*>/)×0,∘⍳∘|-/
Forgot where I learned that from, I think it was Notation as a tool of thought?
0, is expensive, though.
@rabbitgrowth I often use it early on when teaching.
@Adám {⎕IO←0 ⋄ (⊃⍵)+(¯1*>/⍵)×⍳1+|-/⍵}
Wait, I could have just used instead of ⊣/
yes
      A1←{(⌊/⍵)+⌽⍣(>/⍵)⊢0,⍳|-/⍵}
      A2←⊃+(¯1*>/)×0,∘⍳∘|-/
      A3←{⎕IO←0 ⋄ (⊃⍵)+(¯1*>/⍵)×⍳1+|-/⍵}
      RG←+\⊣/,∘(|⍴×)-⍨/
      RV1←{⌽⍣(>/⍵)(⊢,(⍳|-/⍵)+⊢)⌊/⍵}
      RV2←>/{⌽⍣⍺⊢⍵}(⌊/,⌊/+(⍳|⍤(-/)))
      cmpx(⎕A⎕NL¯3),¨⊂' n'
  A1 n  → 1.5E¯5 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  A2 n  → 1.4E¯5 |  -8% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  A3 n  → 1.1E¯5 | -24% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  RG n  → 1.6E¯5 | +10% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  RV1 n → 1.6E¯5 |  +7% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
@Richard You'll also need to reverse the result.
15:21
I started from +\⊣,∘(|⍴×)-⍨ which is used like 3 f 10 instead of f 3 10, so I just slapped / onto and -⍨
You could also reduce using the entire function (and then disclose).
@rabbitgrowth Ah, that explains the ⊣/ instead of
Yep I also wrote down ⊃(+\⊣,∘(|⍴×)-⍨)/, but I wasn't sure if it was a good idea
Should be about the same.
⊃()/ is the "apply dyad as monad" pattern.
It's like "factoring out" the /
Indeed.
And (), or (),⍥⊂ is the "apply monad as dyad" pattern.
I really like the |⍴× fork.
15:26
Me too!
{⊃to/⍵⊣⎕cy'dfns'} was my cheaty solution, btw.
Uses that dyad-to-monad pattern.
how does that work @Adám
The pattern or my cheaty solution?
the cheaty one
⎕cy'dfns' just copies the dfns workspace wholesale.
That includes the to function which does the job as begin to end
15:30
@Adám That is really interesting, I never thought about , that way
So we just reduce with it, inserting it between the two elements, and disclose to counter the enclosing rank-reduction.
@rabbitgrowth Make mainstream-language-people frown by writing it as f(,)
OK, I think we've done this thoroughly enough.
@Adám only the argunments then should both be on the right side
@Richard Sure, that's what the reduction handles.
⊃f/X Y is X f Y
15:48
thanks for today all
If there's nothing else, then see you next week for Move to the Front!
Thanks Adám, I really enjoyed the bit about the "apply monad/dyad as dyad/monad" patterns
good!
 
2 hours later…
17:38
@Adám is grade stable?
18:13
alright so once again I basically have time only today for the whole week, so here are my 2.5 solutions (wow grade is slow!)
{⍵[⍋⍺≠⍵]} and its friend ⊂⍤⍋⍤≠⌷⊢
and the much faster (=,≠)⊢⍤/⊢,⊢
These are solutions to what, @RubenVerg? I'm still learning how the Orchard works
oh sorry
next week's problem
no, no,
you're meant to submit them on friday
but I'm away for the week
where are the problems posed?
18:15
@Adám here
right! Thanks :)
also I'm assuming that Grade is stable (or it wouldn't be in the hint!) but afaict the docs don't specify it (or maybe it's just written in a weird way I don't get)
what does stable mean in this context?
a stable sort is one where items considered equal remain in their same relative position
so like ⍋1 2 1 should be 1 3 2 for it to be stable but 3 1 2 would be an equally acceptable answer if it isn't stable
gotcha
thanks!
18:36
done some testing, afaict dyalog's grade should be stable
dzaima's is too (uses java's Arrays.sort which is stable)
@RubenVerg {⍺∘,⍣(+/⍺=⍵),⍵~⍺}
one issue I'm having is that I can now speak APL a bit better than I can read it (but both rather badly). This is kind of weird
not trying to steal the job of the much better people who host the quests, but just because you are already working on it so early (assuming you have time), try finding another approach (the hint is useful!)
will do :)
with inputs ?100000⍴10 and ?10 cmpx told me your solution is approximately 14000% as slow as mine :)
mine, or Ruben's?
18:42
@Schiphol i've had the same problem for a while, only thing I can recommend is look at code you wrote a few days ago of which you remember the gist but not the point of each function
@Schiphol your solution is ~14000% as slow as either of the ones I have
cmpx {'i_xxf ',⍵,' i_XXF'}¨'G1' 'G2' 'R' 'S'
  i_xxf G1 i_XXF → 3.2E¯4 |      0%
  i_xxf G2 i_XXF → 3.2E¯4 |      0%
  i_xxf R i_XXF  → 1.2E¯4 |    -64%
  i_xxf S i_XXF  → 4.5E¯2 | +13848% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
yours is S
looking puzzled at stuff I wrote a few hours ago is what brought me to this realization lol. But I'll keep trying :)
@RubenVerg lol sobering
hoped it would be an encouragement to improve!
we all gotta start somewhere after all
my first sol to this problem was basically yours but written slightly differently
@RubenVerg absolutely! I'm rather happy having any solutions to this stuff after a couple days of APL coding
if this is the result of just a couple days of apl I'd say it's great
I think the most difficult part of learning APL is getting the understanding of when to use each primitive
... and lots of podcast listening while running, which I'm sure counts too
18:46
which only comes after trying and trying and then trying again
yes, there are many different ways of doing things and I have absolutely no intuition of when and how use one or the other
here's a small tip related to this problem but appliable more generally: when all you need to do is reorder an array, removing stuff and adding it manually somewhere else is probably not the best complexity-wise
squad, replicate etc are your friends
@Schiphol oh and minor nitpick you don't need ⍺∘, - the result of ⍣ called dyadically already does what you want
@RubenVerg by the way this solution's first cousin (=⊢⍤/⊢),(≠⊢⍤/⊢) seems to perform slightly faster even, no noticeable difference with small and medium sized inputs, about 2% decrease with inputs on the order of 1e5 to 1e6 elements
I kinda like the other one more though, looks neater
~5% for 1e7 elements
I think it also depends on the max bounds
ye, ?1e7⍴1e4 has a ~5% decrease and ?1e7⍴1e3 only about ~1%
hmm but ?1e7⍴1e6 does an 8% decrease
idk this is confusing to test
if it comes to time I'll leave it to adam :)
 
2 hours later…
20:53
oh by the way if anyone cares:
* [the wiki](https://aplwiki.com/wiki/Grade) states grade is always stable, but doesn't really have a source. the page was changed from "usually stable" to "stable" with [this edit](https://aplwiki.com/index.php?title=Grade&type=revision&diff=5213&oldid=4920), with comment "it isn't really grade if it isn't stable", to which I somewhat agree but isn't really proof :)
* dzaima's grade is definitely stable (at least on conforming Java runtimes/stdlibs)
* ngn's is definitely stable assuming it's run on a es2019 compliant js engine, and probably stable otherwise (

« first day (2354 days earlier)      last day (518 days later) »