« first day (1920 days earlier)      last day (727 days later) » 

12:14 AM
I had this in Dyalog 17: {(⊢{⍵/⍺}((~∊∘'aeiou'∧((1↓¯1∘⌽∧⊢∧1⌽⊢)(0,(819⌶⎕A)∊⍨⊢)))819⌶))⍵}
Oh this is the same problem as RickeyD was working through a few days ago.
 
 
7 hours later…
7:16 AM
@doug yeah, we'll be working to getting problems.tryapl.org to using 18.2 in the next few weeks I reckon
so you can use ⎕C
 
@RikedyP Sweet. That would be awesome, though I've already finished the lot of them.
 
@rak1507 This might not be official, but if I remember right I think we considered this, but uniform distributions weren't considered the interesting part of the problem or even particularly faithful to the problem domain - if someone wants to submit a solution with non-uniform distributions I don't think we want to punish them, but we did need some definition of random that was a bit more concrete than just the word "random"
 
 
2 hours later…
9:33 AM
Advice please.
 
Take a deep breath.
 
I have a character matix for whihc I want to find all the lines that start with three backticks.
 
Do you want their indices or mask indicating those lines?
 
In order to remove those lines I am using old skool APL with ^.=
 
Hm, I'd write mat⌿⍨~⊣/'```'⍷mat
@user4077425 Hi Logan. If you want to participate here, please email access@apl.chat
 
9:37 AM
IOK, you need the full story I guess. I use two flavours of markdown. One has code blocks surrounded by three backticks; the other indents code blocks by ffour spaces. I am wrigin some code to interconvert them. I'm currently using old skool APL ^.+
And you have answered my question. OK thx bye
:)
PS good to see you again, helpful as ever.
 
If the lines are long, you can get better performance by only looking at the first three columns: mat⌿⍨~⊣/'```'⍷3↑⍤1⊢mat
 
They are. I will.
Not that performance matters much - the files are typically < 200 lines by < 200 chars
 
Might be even faster to do mat⌿⍨'```'≢⍤1⊢3↑⍤1⊢mat or even mat⌿⍨'`'∧.≠⍨3↑⍤1⊢mat
 
Speed freak.
 
Oops, that last one should of course be ∨.≠
Huh, I is fastest:
      +/~⊣/'```'⍷mat←'a`'[?200 200⍴2]
184
      ]runtime -c "mat⌿⍨~⊣/'```'⍷mat" "mat⌿⍨~⊣/'```'⍷3↑⍤1⊢mat" "mat⌿⍨'```'≢⍤1⊢3↑⍤1⊢mat" "mat⌿⍨'`'∨.≠⍨3↑⍤1⊢mat"
  mat⌿⍨~⊣/'```'⍷mat      → 1.9E¯4 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  mat⌿⍨~⊣/'```'⍷3↑⍤1⊢mat → 6.5E¯6 | -97% ⎕
  mat⌿⍨'```'≢⍤1⊢3↑⍤1⊢mat → 6.3E¯6 | -97% ⎕
  mat⌿⍨'`'∨.≠⍨3↑⍤1⊢mat   → 7.8E¯6 | -96% ⎕⎕
      ]runtime -c "mat⌿⍨~⊣/'```'⍷3↑⍤1⊢mat" "mat⌿⍨'```'≢⍤1⊢3↑⍤1⊢mat" "mat⌿⍨'`'∨.≠⍨3↑⍤1⊢mat"
  mat⌿⍨~⊣/'```'⍷3↑⍤1⊢mat → 6.7E¯6 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
9:49 AM
Really helpful, thanks again
For quite a while I've had the beginnings of an APL intro book up on leanpub. I know of two alternatives: xpqz's 'Learning APL' and the updated online 'Mastering Dyalog APL'. I think they are both better, so I'm planning to retire mine and point readers to the alternatives. Does that make sense?
 
@RomillyCocking Is it available to see?
 
leanpub.com/learnapl (and set the price to zero)
 
@RomillyCocking What is the target audience for your book?
 
Beginners who are curious about the language, especially readers of school age
who have a Raspberry Pi
 
10:04 AM
I was thinking what type of knowledge do you assume they have, but if it is for kids, then I'd love to see it finished, as that type of material is missing. xpqz's book is for non-APL programmers, and Mastering is too heavy for kids.
 
OK. I'll put it in the work queue. Sigh.
 
Well, I don't want to burden you. xpqz loves writing about APL. Maybe he'll be willing to help. If you're interested in that, you can just ping him here using @xpqz
@oeuf Hi there. Interested in APL?
 
@RomillyCocking I concur: if you have the cycles, it'd be great to see it finished -- the more material there is out there, the more it benefits adoption. I have my "APL time" accounted for right now, so not sure if I could contribute much to the effort, I'm afraid.
 
I'm not going to have time for ~6 mo. Since I am ~75, that might mean never. But I'll put it in the queue.
 
10:30 AM
@RomillyCocking Some of the things you write should be updated to account for modern developments. Let me know when it is relevant, and I'll be happy to assist. While I hope you'll be around for a good many (healthy) years, consider publishing the source such that others can contribute to your work.
 
 
3 hours later…
1:56 PM
I am trying to fully understand the power operator. So I made some combinations to understand it's working/ I'll show some examples.
⋄ ({×2}⍣4) 2
 
@Richard 1
 
{×2} is the same as {1}
 
Here × is monadicly used
⋄ ({⍵×2}⍣4) 2
 
@Richard 32
 
Right, this is the same as {⍵×2} {⍵×2} {⍵×2} {⍵×2} 2 or 2*5
Btw, you can write 2×⍣4⊢2
 
2:00 PM
yes, it's one of the next examples :)
⋄{⍵×2}⍣4+2
 
@Richard 32
 
+ is now just a delimiter/monadic function to seperate the argument 2?
⋄{⍵×2}⍣4⊢2
 
@Richard 32
 
like this one I presume
⋄ (2∘×)⍣4⊢2
 
@Richard 32
 
2:04 PM
2 and × are binded to 1 function?
 
@Richard Well, yes, for real numbers.
 
⋄ {⍵×2}⍣4⊣2
 
@Richard 32
 
@Richard Yes, is literally called bind (when used like this).
 
And where is ⊣ refering to in this example? There is no left argument, so it takes the right argument?
 
2:07 PM
Yes, that's the definition of i.e. {⍺←⍵ ⋄ ⍺}
 
⋄(×∘2)⍣4⊢ 2
 
@Richard 32
 
is x∘2 equivalent to 2∘x?
 
Yes, because × is commutative.
 
⋄{⍵×2}⍣4+2
 
2:10 PM
@Richard 32
 
and what is the + doing here? Just a monadic function wich seperates the argument for the ⍣ operator?
 
Complex conjugate, but also separates the 4 operand from the 2 argument.
 
Thanks :)
 
3:00 PM
Welcome to the APL Quest! Today's quest is Tell a Fib:
> Write a dfn that takes an integer right argument and returns that number of terms in the Fibonacci sequence.
Note that we have to return the full list beginning with 1 1 2…, not the nth number. Any bids?
 
{{⍵≤1:⍵ ⋄ (∇ ⍵-2)+∇ ⍵-1}¨⍳⍵}
 
I had f←{(⊢,(+/¯2↑⊢))⍣(⍵-2)⊢1 1} and was amazed that f 1 worked. I was like, "This can't possibly work." and then, ""
f 0 fails, though.
 
@Richard That's very wasteful :-)
 
yes I know...
 
Mine was {r←⍬⋄_←{{p←+\⌽⍵⋄r,←⊃p⋄p}⍣⍵⊢0 1}⍵⋄r}
 
3:01 PM
Tried something with the power operator but didn't succeed
 
{⊃{⍵,+/¯2↑⍵}/⌽⍳⍵} ⍝ also fails for 0
 
found a very nice one on the intertnet however.
{⊃+\∘⌽⍣⍵⍳2}
not mine!
 
@rabbitgrowth {⍵↑(⊢,(+/¯2↑⊢))⍣⍵⊢1 1} works.
Btw, it can be written as {⍵↑¯2(⊢,1⊥↑)⍣⍵⊢1 1}
 
@Richard I don't think that does the right thing
It returns the nth element, not the sequence up to it.
 
yes, but that can be fixed
{{⊃+\∘⌽⍣⍵⍳2}¨⍳⍵}
 
3:07 PM
@Brian {¯1↓⊃{⍵,+/¯2↑⍵}/0,⌽⍳⍵}
 
@Richard ...but now it's super-wasteful again
 
:(
 
@Adám yup :)
 
@Brian How does this work?
 
@Richard it uses reduction for its iteration
 
3:11 PM
Can I have a proper tail-recursive version?
 
@Brian very nice.
 
{⍺←0 1 ⋄ ⋄⍵=0:⍬⍴⍺ ⋄ (1↓⍺,+/⍺)∇ ⍵-1}⍝ tail recursive
 
O(n²) tacit solution which eventually suffers from floating point inaccuracies, but is short: 1∧∘÷+∘÷\⍤⍴∘1
@Brian That only computes the last value, no?
 
ah right
 
what is tail recursive? (sorry that I am slow, I am trying to understand all the proposed sollutions and trying them out)
 
3:15 PM
Tail recursive means it uses recursion, but the value returned when the recursion bottoms out, isn't further processed.
 
ah, that's also the problem of my suggestion :)
 
Yes, + is used after the return. This means memory will fill up with the stack.
 
ovs
Somewhat inefficient: {⍵↑(⊣,2+/⊢)⍣⍵⍨1 1}
 
What if the calculated values are remembered? That would be much more efficient. In my case the same number is calculated many times
 
Sure, you could memo it.
I have {⍺←⍬ ⋄ ⍵≤≢⍺:¯2↓1 1,⍺ ⋄ ⍵∇⍨⍺,+/1⌈¯2↑⍺} but I'm pretty sure it can be improved.
 
3:20 PM
{⍺←1 1 ⋄ ⍵≤≢⍺:⍵⍴⍺ ⋄ (⍺,+/¯2↑⍺)∇ ⍵}
 
there's an interesting solution with !
 
@Richard Btw, you can test for tail recursion by checking the length of ⎕SI: If it stays 1, then you've got tail recursion.
 
@KamilaSzewczyk like here? jsoftware.com/papers/50/50_36.htm
 
i believe that this is it, yes
there's also the mildly inefficient matrix multiplication solution
 
Lots of solutions to the nth are listed at dfns.dyalog.com/n_fibonacci.htm
@KamilaSzewczyk Do you have a non-¨ solution using that?
 
3:24 PM
i do not, i haven't prepared.
but i think that you could make it work without any maps with the Binet formula
 
But that'd end up with inaccuracies due to floating point.
⋄ {(((2÷¯1+2*∘÷⍨5)*⍵)-(1-phi←.5×1+5*.5)*⍵)÷5*.5}⍳10
 
@Adám 1 1 2 3 5 8 13 21 34 55
 
@Adám no.
 
No?
 
at least not within the first 1000 fibonacci numbers
 
3:28 PM
Cleaned up version: {s÷⍨(⍵*⍨2÷s-1)-⍵*⍨1-2÷⍨1+s←5*.5}
There's a primitive pair missing: *⍨ and *∘÷⍨
The last one should obviously be denoted but I have no ideas what symbol could work for *⍨
@KamilaSzewczyk Can you reveal?
 
@Richard already listed in here
* × - all autovectorise, so it should almost definitely be doable.
 
How can I set the interpreter to use more digits? With ⎕PP? But that gives rounding erros
 
@KamilaSzewczyk {1 2∘⌷¨+.×\⍵⍴⊂2 2⍴0 1 1 1}
 
@Richard ⎕FR←1287 ⋄ ⎕PP←34 The first switches to 128-bit decimal floats. The second is just the print precision and doesn't affect computation.
 
3:38 PM
:)
 
I wrote a blog post about Fibonacci a while back... dyalog.com/blog/2014/11/…
 
@Brian Uh, yeah, that's why we're having this event today :-)
 
Oops :)
 
No worries. I didn't say "2014-3" when we started. Maybe I should include that with my welcome message going forward.
 
@Brian will read that later, thanks!
 
3:41 PM
I had {⍵↑(⊢,∘(+/)¯2∘↑)⍣(0⌈¯2+⍵)⊢1 1}
It looks a bit like the poor man’s ovs solution.
And almost exactly like rabbitgrowth’s.
 
It is pretty much equivalent to Richard's too.
 
@Adám Is 256 or 512 bit decimals also being incorporated or is that not usefull, except for these kind of puzzles?
@Adám but looks much smarter :) (Dough's solution)
 
@Richard Not yet, but we're planning "infinite precision" eventually.
@doug Evolution:
{⍵↑(⊢,∘(+/)¯2∘↑)⍣(0⌈¯2+⍵)⊢1 1}
{⍵↑(⊢,1⊥¯2∘↑)⍣(0⌈¯2+⍵)⊢1 1}
{⍵↑¯2(⊢,1⊥↑)⍣(0⌈¯2+⍵)⊢1 1}
{⍵↑¯2(⊢,1⊥↑)⍣⍵⊢1 1}
Any others before we finish with the "industrial" OO solution?
 
Btw, this is just a minor inconvenience, but the links to the 2014 problems on aplwiki.com/wiki/APL_Quest are broken because of extra ) characters.
 
@Adám Thanks!
 
3:51 PM
@rabbitgrowth Fixed.
 
Thanks!
 
OK, here it is, lightly adapted from Paul Mansour's original, in all its glorious horror:
Fibonacci←{⎕IO←0        ⍝ First ⍵ fibonacci numbers.
    s←⎕NS''             ⍝ Class
    s.(f←{⍺←⎕THIS ⋄ ⍺.i<2:⍺.n ⋄ ⊢⍺.n←+/⍺.a[⍺.i-1+⍳2].n}) ⍝ Method
    0::⍬                ⍝ NONCE on next operation if ⍵=0
    v←⎕NS¨⍵⍴s           ⍝ Collection
    v.i←⍳⍵              ⍝ Item number
    v.n←⍵↑1 1           ⍝ Initialize
    v.a←⊂v              ⍝ Each knows all
    v.b←(1+⍳⍵)⍴¨⊂v      ⍝ Each knows self and previous?
    v.f 0               ⍝ Compute
}
Try it online: https://tio.run/##bZK/T8JAFMd3/oq3ASHUlpFoHAhEBmHAzTgc5SoXj7umV/BXWIxhwNTowOji5OCmLIz@KfeP1HfXQkzxLX13@Xy/7943JSGvj24Jl5dp2mFDKYjvM714udfPq24fGxfy0skbdFikYuzWEGxZENPJkEbKKRlIoQKVvUG5DH/LiFucKJVRTiWwM5JNxp@ddAegnx6R2zjssNE0X5HdLN/tAcHagenIuYXqXk0nX40LR8yr1v6UxmM5sv5uEw0@oVAG6vV7rTZIAYLexCBDGpGY4ZEFZqsj18pn2yV@PvBSJ9@quInknPpGmPGOSQxfY4LZG9mN6SQPKaeFpdd68eqBV6QFixnh7I7mMDHw8mG2b9wm/hiuhLxWQDjP8SHiFRsNTqji23GHnbqgUpQHQMQIwojOmJyq49wkAPef7FpyEk5jWpqXMBwcs/tdwHPT9Bc
 
That's like something @Razetime would write for a dare.
 
Let's end on that note. Thank you, everyone, and see you next week!
 
Thanks! Really nice ending of the week again. Looking forward to the video!
Although the last sollution made me feel stupid again...
 
3:58 PM
What, the OO one?
 
Are we supposed to turn foo bar into foo bar for next week's problem?
 
@Adám yes
 
It is completely bonkers. Don't worry about it.
 
OO might be a nice subject for another time
ah ok. Even that I didn't see
 
@rabbitgrowth Yes, but also remove leading and trailing spaces.
 
4:01 PM
Got it. Wasn't sure if multiple non-leading-or-trailing spaces counted
 
@rabbitgrowth Thank you for pointing my attention at it. The problem statement is missing spaces!
Fixed.
@PaulMansour What a coincidence. See above ↑↑↑
 
4:16 PM
@xpqz wow this is beyond me
I must try seeing this in the debugger
 
The comments are delightfully non-illuminating.
 
4:33 PM
Phase 2:6 will sort the wheat from the chaff.
 
i should start in phase 2
 
i have completed most of phase 2 but i intentionally left out two problems
because i don't want to self-dox in case i win, so i'm just making sure that i don't
 
Contemplating shelling out to Python.Arrow...
 
billion points for py'n'apl usage
 
That would be tres cool.
 
4:56 PM
@KamilaSzewczyk couldn't you ask dyalog to redact personal info? (cc @Adám)
@xpqz there are only approximately 126 billion different possible DDNs, simply try them all and return the one that works :P
 
5:20 PM
@rak1507 dyalog seems to have doxed Dzaima already, though?
i doubt dzaima enjoyed it from what i heard
 
I personally don't think it is bad, because get GPG key signed by others also requires showing legal identification.
But there are a few people I know publishing papers with anime characters' name
 
@KamilaSzewczyk i'm fine with it, it wouldn't be too hard to find it anyway; all I care about is there not being any page containing both my real name and "dzaima" in any relation
 
@rak1507 maybe there’s an inverse!
 
5:38 PM
@xpqz my conspiracy theory is that dyalog can't be bothered writing (1200⌶)⍣¯1 so they're getting us to do it for them :P
 
6:11 PM
@LdBeth i don't want to link my appearance and place of residence with my online persona, at least in a very public way
 
 
1 hour later…
7:29 PM
Understandable, I once had the same thought but failed at certain point.
 

« first day (1920 days earlier)      last day (727 days later) »