« first day (2459 days earlier)      last day (188 days later) » 

4:52 AM
@Ven What‽ Sure doesn't for me.
@CommandMaster Hi there. Interested in APL?
 
5:19 AM
@Adám Hi! I'm bored so I thought it might be fun, but I'm not sure where to start
 
6:08 AM
@CommandMaster Great. I can give you a quick personalised intro, or you can go on your own to apl.wiki/Learning_resources
 
7:00 AM
I think I'll try the resources, thanks! I'm trying to install Dyalog APL, but when running it I get this error:
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '3.1.0' was not found.
- The following frameworks were found:
5.0.17 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
 
 
3 hours later…
9:43 AM
@CommandMaster Right, while that isn't critical (.NET isn't required), you can either follow these instructions or download the pre-release 19.0.
 
 
3 hours later…
1:00 PM
Welcome to APL Quest 2021-10! Today's quest is On the Right Side:
> Write a function that:
> • has a right argument T that is a character scalar, vector or a vector of character vectors/scalars.
> • has a left argument W that is a positive integer specifying the width of the result.
> • returns a right-aligned character array R of shape ((2=|≡T)/≢T),W meaning R is one of the following:
> ⠀○ a W-wide vector if T is a simple vector or scalar.
> ⠀○ a W-wide matrix with the same number rows as elements of T if T is a vector of vectors/scalars.
> • if an element of T has length greater than W, truncate it after W characters.
This is a lengthy spec for something that's actually quite simple.
 
↑↑⍨¨∘-⍨∘⊆
 
Yup, although I think an explicit version will be easier to comprehend — until we get
 
{↑(-⍺)↑¨⊆⍵}
 
Exactly.
 
↑-⍤⊣↑¨⊆⍤⊢ seems nice too.
 
1:03 PM
I was just about to say that :-)
 
This is a good example of the "split-compose" pattern:
Oct 13 at 14:58, by RubenVerg
@Adám early submission, as always: ↑-⍛↑¨∘⊆
Technically, it should be ↑-⍛(↑¨)∘⊆ to avoid - applying to scalars, but it probably doesn't matter compared to adjusting the length of character vectors.
 
Wouldn't ↑-⍛(↑¨)∘⊆ be better?
 
GMTA
 
I think it's faster too, because you only do the - once?
 
1:07 PM
> avoid - applying to scalars
 
Oh, right.
 
      Ⓞ←{(⍺⍺ ⍺)⍵⍵ ⍵}
      words←(?100⍴10)↑¨⊂⎕A
      cmpx'5(↑-Ⓞ↑¨∘⊆)words' '5(↑-Ⓞ(↑¨)∘⊆)words'
  5(↑-Ⓞ↑¨∘⊆)words   → 2.6E¯5 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  5(↑-Ⓞ(↑¨)∘⊆)words → 1.1E¯5 | -56% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
I wonder if it'd be faster to do a single .
 
{⌽⍉⍺↑⍉↑⌽¨⊆⍵}
 
Good, although I'd avoid the transposes:
      cmpx'5(↑-Ⓞ(↑¨)∘⊆)words' '5{⌽⍉⍺↑⍉↑⌽¨⊆⍵}words' '5{⌽⍺↑⍤1↑⌽¨⊆⍵}words'
  5(↑-Ⓞ(↑¨)∘⊆)words  → 1.2E¯5 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  5{⌽⍉⍺↑⍉↑⌽¨⊆⍵}words → 8.2E¯6 | -32% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  5{⌽⍺↑⍤1↑⌽¨⊆⍵}words → 7.7E¯6 | -37% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
Nice!
 
1:14 PM
Maybe we can do a single reversal too.
No, wait, that won't work.
Actually, we might be able to rotate…
Not a beauty: {(-⍺)↑⍤1(((⊢-⌈/)≢¨)⌽↑)⊆⍵}
But look at that:
      cmpx'5{⌽⍺↑⍤1↑⌽¨⊆⍵}words' '5{(-⍺)↑⍤1(((⊢-⌈/)≢¨)⌽↑)⊆⍵}words'
  5{⌽⍺↑⍤1↑⌽¨⊆⍵}words              → 7.4E¯6 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  5{(-⍺)↑⍤1(((⊢-⌈/)≢¨)⌽↑)⊆⍵}words → 4.3E¯6 | -42% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
That makes it beautiful :)
 
Morale: Keep it flat!
Now I want to know if ≢¨ can be sped up by counting trailing blanks. (Though the problem spec doesn't guarantee no trailing blanks.)
Nah, that'll be slower.
 
How are you counting trailing blanks?
 
⊥⍨⍤1=∘' '
 
That is quite clever
 
1:30 PM
Not my invention:
Bravo! In fact, because of Dan, we special-cased b⊥b and ⊥⍨b giving up to infinite speed-up. — Adám Nov 6, 2016 at 19:18
Oh well, I think we can stop here, but do post if you make something faster. And with this, we finished 2021! See you next week for 2022-1: Counting DNA Nucleotides?
 
Thanks Adám and see you next week!
 
 
4 hours later…
Ven
5:19 PM
@Adám Might be an artifact of tryapl?
 
 
5 hours later…
9:55 PM
@Adám Is there a plan for integrating into core Dyalog? Or is it staying in Extended Dyalog?
 
0
Q: Dyalog APL, sort rows in a matrix

Kuushu EnshinI would like to sort numbers within each row of a matrix, for example, 3 3 rho 2 3 1 4 5 7 1 9 8 should become 3 3 rho 1 2 3 4 5 7 1 8 9 help? thank you I am new to dyalog apl, and know how to generate, via grade the matrix 3 3 rho 3 2 1 1 2 3 1 3 2 from the initial matrix

 

« first day (2459 days earlier)      last day (188 days later) »