« first day (1817 days earlier)      last day (845 days later) » 

1:18 AM
@Adám Is there a golflang made with APL?
 
I've made three: QuadR, QuadS, and Stencil.
 
You can find them via TIO
 
Try it online! Is not a Hello, World!
 
No, you're right, that's more like a cat
 
1:23 AM
@Adám What is the best tip for golfing in APL?
 
codegolf.stackexchange.com/questions/17665/… Plenty of tips here. I don't think there's a "best"
 
I'd say it is to know the language well.
 
 
7 hours later…
8:38 AM
@FawnLocke Thank you so much for creating the Key page on APL Wiki!
 
 
2 hours later…
11:06 AM
@Adám, in this video the approximation for ∏ is completely wrong. I tried on TryAPL and it is still wrong. Is this a known problem? I think it has to do with floating point precision in internal calculations.
⋄ ((÷/1↓⊢)+⊃)(1∧0 1∘⊤,÷)○1
 
@AlexB 5.093937333
 
⋄ ((÷/1↓⊢)+⊃)(1∧0 1∘⊤,÷)3.141593
 
@AlexB 3.141593
 
⋄ ((÷/1↓⊢)+⊃)(1∧0 1∘⊤,÷)3.1415927
 
@AlexB 3.400642929
 
11:08 AM
That doesn't look right.
 
You can see that it starts misbehaving at 3.1415927
The more decimal digits, the more it diverges.
⋄ ((÷/1↓⊢)+⊃)(1∧0 1∘⊤,÷)3.14159265358979
 
@AlexB 4.810752026
 
Even worse if you ask for more precision: ⋄ ⎕CT←0 ⋄ ((÷/1↓⊢)+⊃)(1∧0 1∘⊤,÷)3.1415927
 
@Adám 17.6756
 
I think the algorithm is correct, but the internal representation is a problem. Either the reciprocal or the lcm or both.
Either way, you might want to not advertise this algorithm as good for ∏ approximation.
 
11:11 AM
We need to look into this. Thanks!
 
I doubt it's a Dyalog interpreter problem. It looks like the limitations of a numeric algorithm.
 
pi approximation
the simplest one i can come up with is using arctan(1)
 
@KamilaSzewczyk I was not trying to compute PI. I was watching Richard's video and I noticed something was wrong.
 
I know, I was just thinking how i'd approach it.
 
This seems to work: ⋄ ÷/((,÷∨)∘1)○1
 
11:14 AM
@Adám 3.141592654
 
this is extra lame though.
it turns a pi constant into a rational and then back to a float.
 
I think the train proposed by Richard in the video for a fraction equivalent to a rational number is nice, but it works only up to about 7 significant digits.
 
@KamilaSzewczyk We're trying to look at the validity of the generated rational, hence turning it back into float.
 
I remember stumbling upon the exact same issue in kamilalisp funnily enough
with the precision making the rational approximation worse
i didn't find a solution to it sadly
i think it might just be floating point inaccurancies?
 
@KamilaSzewczyk Typically one resorts to double precision for internal calculations. In Dyalog it's not available.
 
11:16 AM
it's not really a matter of precision, some numbers are not representable as floats in the binary representation.
and the error creeps
i have zero idea why it creeps more the larger the algorithm's precision is, though.
 
In computing, quadruple precision (or quad precision) is a binary floating point–based computer number format that occupies 16 bytes (128 bits) with precision at least twice the 53-bit double precision. This 128-bit quadruple precision is designed not only for applications requiring results in higher than double precision, but also, as a primary function, to allow the computation of double precision results more reliably and accurately by minimising overflow and round-off errors in intermediate calculations and scratch variables. William Kahan, primary architect of the original IEEE-754 floating...
 
yeah, heard of that. kamilalisp worked on MPFR floats which funnily enough suffer from the same thing.
 
@KamilaSzewczyk Yes, but this doesn't look like it's a representation problem. PI digits are random and they cannot all be idiosyncratic for binary representation.
 
⎕←{4×1++/(¯1*⍵)÷(1+2×⍵)}∘⍳¨1E2 1E4 1E6
 
@KamilaSzewczyk 3.151493401 3.141692644 3.141593654
 
11:21 AM
could use Shanks transformation to make it converge quicker. I always wanted to write an APL blog post about Shanks transformation anyway.
 
OK, I've sent an email to our internal language group, but don't expect a response until tomorrow.
 
@Adám i think it'd probably be 1∧ choosing different multiples from the two arguments its given
 
Oh, that might make sense. It can't find a "correct" value, so it just chooses something.
 
@KamilaSzewczyk it's your chance to do it! :)
 
so unless (1∘|,÷) always keeps precise info about what fraction 1∧ would think each element there is, 1∧ will fail sometimes
 
11:24 AM
too busy with cooler stuff for now :3
but i can reveal it only in approximately two weeks
 
@dzaima actually, the issue is more in that ÷s argument is the raw un1|ed thing, (1∧⊢,÷)1|x is pretty good. But that "will fail sometimes" still holds, it's just that ÷ getting 3.141 instead of 0.141 makes it lose a lot of precision and makes that "sometimes" more likely
 
With rational arith I get 1E4 => 3.141692643590543, still computing 1E6...
 
Precise 128-bit decimal floats:
 
@Adám
NOT PERMITTED: Illegal token
      ⎕FR←1287 ⋄ ⎕DCT←0 ⋄ ((÷/1↓⊢)+⊃)(1∧0 1∘⊤,÷)○1
                ^
 
11:40 AM
@hyper-neutrino If I remove the triggering code, the bot should treat it as it does removing the entire message, no?
      ⎕FR←1287 ⋄ ⎕DCT←0
      ((÷/1↓⊢)+⊃)(1∧0 1∘⊤,÷)○1
3.141592654
      (○1) = ((÷/1↓⊢)+⊃)(1∧0 1∘⊤,÷)○1
1
 
11:57 AM
hmm, I give up after 10 minutes
 
@Adám so, with 128 bits it seems to work?
 
Only if you also set the decimal comparison tolerance to 0.
 
@Adám I am not talking about the = in the 2nd statement. I am talking about the visible digits in the 1st statement. They don't diverge. The result looks converged.
 
..and 3.01234567890123456789 fails
 
Yeah, this is probably an exercise in futility. We're trying to exude exactness where none is to be found.
 
12:06 PM
well i did give you a logical reason for why you won't get this to work
 
@Adám I agree. Sorry for triggering this. All I think needs to be done is note that Richard's train cannot be used to approximate π.
 
so uh this is probably a big no-no, but I just used to treat a scalar as a single unit in a train: ⌊(⍴÷3⍨)
that should tell you how many times any number can be divided by 3 ignoring remainder
 
@lyxal that's what it's kinda meant for actually
 
oh okay good
I thought that wasn't something you were supposed to do with selfie
TIL.
 
@lyxal "a number"? You mean a string/list/vector?
@lyxal It is called Constant when used with an array operand.
 
12:11 PM
@Adám ah yeah that's right - the length of a string
 
Consider using instead of as the former will give you a scalar rather than a vector result.
 
@AlexB Is that also this? aplcart.info/?q=convert%20fraction#
I'll put a link to this conversation as a YT comment
 
12:40 PM
@RikedyP This seems to work
⋄ ÷/((,÷∨)∘1)○1
 
@AlexB 3.141592654
 
1 hour ago, by Adám
This seems to work: ⋄ ÷/((,÷∨)∘1)○1
 
@dzaima 3.141592654
 
CMP: Should the bot react to quoted commands?
⎕←'⋄ ⍳3'
 
@Adám ⋄ ⍳3
 
12:45 PM
It doesn't react to itself.
 
@Adám do you mean it should react to itself?
 
@dzaima so maybe this can be used to find the fraction in the form a + b/c
⋄ (2⌽((,÷∨)∘1(⊢-⌊)),⌊)○1
 
@AlexB 3 3612111 25510582
 
@PyGamer0 No, I meant that just like it doesn't react to itself, it shouldn't react to quotes either.
 
(I am sure some of the train wizards can improve on my poor train)
 
12:52 PM
@AlexB i am not a train wizard, i am a train beginner
 
@PyGamer0 I was replying to @dzaima and @Adám
 
@Adám the code has already been evaluated, it's just wasted space. And if it's from a long time ago, you can just click it
 
(the threads got mixed up)
 
Someone who teaches trains can be described as a "trainer", right?
 
@AlexB i was just saying ;)
 
12:53 PM
@Adám or a train conductor...
 
@AlexB 2⌽(,÷∨)∘1⍤-∘⌊⍨,⌊
 
@AlexB (⌊,1(,÷∨)⍨1|⊢)○1
 
Great. One of these can replace the train that derailed with π.
(BTW, the more I learn APL, the less I know — typical Dunning-Kruger effect)
Learning APL has a very humbling effect. I think it should be mandatory learning for politicians of all colors. :-)
 
@AlexB wait until you try C++ ;)
 
1:14 PM
@Adám You're welcome! I've wanted to contribute more, I'm just insecure about my writing style ^^'
 
@KamilaSzewczyk I tried C++ in 1989 and I didn't like it. I sympathize with Alan Kay on this.
(to me C++ is in the same group with JS and PHP)
 
@FawnLocke It is fine, and prompts others (i.e. me) to contribute more.
 
1:43 PM
@AlexB C++ is actually quite fine to program in if you just ignore everything and write it like C
still a very usable, feature filled but bloated, fast language which i wouldn't put anywhere near js or php
 
@Razetime and JS is quite fine to program in if you ignore 97% of the language too. PHP, though..
 
lol
 
Malbolge is also quite fine to program in if you ignore 100% of the language.
 
Malbolge is actually fine to program in :)
 
@KamilaSzewczyk so says, give or take, the single person in the world who actually can
 
2:00 PM
@Razetime of course. That’s what I did. (BTW C++ was a C preprocessor, so you could just write K&R C)
 
hm C++ has C inside of it so at least i know what i can use without banging my head, but js has some basic things that are quite bees
 
Tacit version of 2 1 1 1 2{⍺⌿⍺/⍵}5 5⍴1?
Also, is there a better way to generate ⍺ than (1+⍳∊1∘,)⍤≢?
 
@KamilaSzewczyk you use a transpiler that transpiles to malbolge right?
 
who knows
 
I've just thought there there is no reason to tacify it, It's already short, and I can do something like {mask⌿⍵/⍨mask←(1+⍳∊1∘,)⍤≢ ⍵}5 5⍴⍳1.
But I'm still curious
 
2:14 PM
@KamilaSzewczyk idk, you?
 
2:28 PM
@MasterQuiz replicate sucks in trains, ⊣⊢⍤⌿⊢⍤/ is my attempt
In an ideal world ⊣⌿/ would work
 
@FawnLocke I was trying (⊢⍤⌿⊢⍤/)
 
Doesn't work , a dyadic atop is g X f Y, i.e ⌿ doesn't get the left argument it needs
 
@FawnLocke In ideal world there would exist this operator 2 1 1 1 2(⌿{⍺ ⍺⍺ ⍺ ⍵⍵ ⍵}/)5 5⍴1
 
Well that's just the fork (⊣⍺⍺⍵⍵) so I don't see much utility in having an operator for it
 
@FawnLocke Yes, it's just that I've always thought that it recognise itself when a function should be used dyadically; but I guess also this doesn't make much sense
 
3:40 PM
@Adám ... I thought it was supposed to ¯\_(ツ)_/¯
 
4:23 PM
@hyper-neutrino It removes its message if I remove mine, but it doesn't remove its message if I remove the triggering code from my message, leaving the rest of the message there.
 
4:59 PM
@FawnLocke but this doesn't work in the way that @MasterQuiz needs. I am not sure how common its use would be, but I tend to agree with @MasterQuiz that the operator that he suggests is different and is exactly what he needs in his case.
@MasterQuiz, if you don't want to define an operator, you might just create a dedicated dfn:
⋄ 2 1 1 1 2{⍺⌿⍺/⍵}5 5⍴⍳25
 
@AlexB
 1  1  2  3  4  5  5
 1  1  2  3  4  5  5
 6  6  7  8  9 10 10
11 11 12 13 14 15 15
16 16 17 18 19 20 20
21 21 22 23 24 25 25
21 21 22 23 24 25 25
 
How is it different?
 
@AlexB (⊣ f g) works precisely the same as f{⍺ ⍺⍺ ⍺ ⍵⍵ ⍵}g (if ignoring slashes sucking, which is mostly unrelated)
but there are at least 4 such useful operations - (⊣ f g), (⊢ f g), (f g ⊣), (f g ⊢) - and having an operator for each is a lot of characters. And there are quite a lot more frequent useful forks. You're not really even saving any characters if there were operators for those (the only exception being said already-awful slashes)
 
@dzaima I never suggested adding an operator to the language. I was trying to analyze @MasterQuiz's problem and suggest solutions dedicated for him.
@FawnLocke Not different in principle but, as @dzaima pointed out (and you as well), it doesn't work with slash. Thus, @MasterQuiz has to use something else. Of course that's what he started with, so in a sense I went full circle to confirm (to myself) what he already knew.
 
It does, it's just ugly
(⊣⊢⍤⌿⊢⍤/)
 
5:08 PM
@FawnLocke It's a bit less readable, IMO.
 
5:20 PM
If it wasn't for the stupidly working (,1)⌿1 2 3 4 I'd extend / so you could write ⍺ ⍺⌿⍵ meaning ⍺⌿⍺/⍵ (for matrices).
Wait, that's nonsense.
It if wasn't for 1≡⊂1
But (,1)(,1) is distinguishable from 1 1 so it could work to extend to map nested s over leading dimensions.
 
Huh how does (,1)⌿1 2 3 4 work
 
Sillily.
In many places, many APLs allow 1-element vectors (or even any singleton) where a scalar should be required.
It is largely because was missing, so (ab)use of lead to 1-element vectors where a scalar should have been.
Actually, in this particular case, it is a good thing that ,1 is treated as a scalar, because it allows writing and enclosed "scalar" as ⊂,1
 
@Adám of course, that's just being missing and so (ab)using for it
 
No, wouldn't help. You still can't enclose a simple scalar.
 
ah i misread (,1)(,1) as being the proper per-axis matched item replicate, which it isn't as there'd a constant length for each axis there
@Adám 1 2/2 2⍴⍳4 also works, and is a lot more important
 
5:32 PM
I don't follow.
I'd want (1 2)(3 4)⌿2 2⍴⍳4 to mean 1 2⌿3 4/2 2⍴⍳4
So how would you write 2⌿3/2 2⍴⍳4? — (,2)(,3)⌿2 2⍴⍳4
 
@Adám you complained about singleton extension blocking just 2 3⌿2 2⍴⍳4, but i'm pointing out that regular replication also doesn't allow extending that
ah right after that there's "wait, that's nonsense" :| ignore me
 
Yeah, my singleton complain was a mistake. What blocks it is the lack of enclosed simple scalars. What rescues it is singleton extension.
 
6:11 PM
How to take the vector of greater length between two vectors that has some scalar in common?
An example: (≢2 4)>(≢4), (≢7 10 11)>(≢10 11)>≢(,11), (≢3 5 8)>(≢,3)
⋄(,1)(,4)(6 9)(,11)(2 4)(7 10 11)(,3)(3 5 8)(10 11)
⋄(,1)(6 9)(2 4)(7 10 11)(3 5 8)
 
@MasterQuiz
┌─┬─┬───┬──┬───┬───────┬─┬─────┬─────┐
│1│4│6 9│11│2 4│7 10 11│3│3 5 8│10 11│
└─┴─┴───┴──┴───┴───────┴─┴─────┴─────┘
┌─┬───┬───┬───────┬─────┐
│1│6 9│2 4│7 10 11│3 5 8│
└─┴───┴───┴───────┴─────┘
 
"scalar in common" do you mean 1-element vector?
 
@MasterQuiz Is the common scalar actually relevant, or do you just want the longest of two vectors?
 
@FawnLocke No, each item of the vectors
@Adám The longest of multiple vectors that have a common element
I can also have this matrix, maybe better cause I have to use the result as a mask after, and because I obtained the vector from this matrix
⋄ ↑(,1)(,4)(6 9)(,11)(2 4)(7 10 11)(,3)(3 5 8)(10 11)∊⍨¨⊂⍳11
 
@MasterQuiz
1 0 0 0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0 0
0 0 0 0 0 1 0 0 1 0 0
0 0 0 0 0 0 0 0 0 0 1
0 1 0 1 0 0 0 0 0 0 0
0 0 0 0 0 0 1 0 0 1 1
0 0 1 0 0 0 0 0 0 0 0
0 0 1 0 1 0 0 1 0 0 0
0 0 0 0 0 0 0 0 0 1 1
 
6:50 PM
@Adám, I think there is a slightly unclear statement in the [Expand wiki page](https://aplwiki.com/wiki/Expand#Examples). It reads "For vector arguments, the number of positive values in the left argument must match the length of the right argument." but I think it should read "For vector **right** arguments..."
If you agree, I could edit the page.
 
Yes, that seems right. Go ahead.
 
7:25 PM
@Adám Done. Thanks.
 
7:47 PM
I don't understand why the first example succeeds and the second fails.
⋄ (⍳2) {⍺ (,⍤0) ⍵} 10×⍳2
 
@AlexB
1 10
2 20
 
⋄ (⍳2) ({⍺ (⍵⍵⍤0) ⍵},) 10×⍳2
 
@AlexB (1 trailing line)
VALUE ERROR
      (⍳2)({⍺(⍵⍵⍤0)⍵},)10×⍳2

␄
 
They should be equivalent, shouldn't they?
 
⋄ (⍳2)(,{⍺(⍺⍺⍤0)⍵})10×⍳2
 
7:49 PM
@FawnLocke
1 10
2 20
 
A monadic operator has a left function operand, not a right one
Also btw you don't need brackets around ,{⍺(⍺⍺⍤0)⍵} operators are parsed "first"
 
@FawnLocke But doesn't depend on whether I specify double-alpha or double-omega? It seems that this rule is cast in stone, regardless of how I specify the operator.
This works:
⋄ (⍳2) (,{⍺ (⍺⍺⍤0) ⍵}) 10×⍳2
 
@AlexB
1 10
2 20
 
But it's different from what I wanted. I wanted the operator to associate on the right. Apparently this is not allowed?
 
@AlexB You can, but it has to have also a left operator
⋄ (⍳2) (⊢{⍺ (⍵⍵⍤0) ⍵},) 10×⍳2
 
7:58 PM
@MasterQuiz
1 10
2 20
 
@MasterQuiz I see. There are some weird rules cast in stone in Dyalog APL, as I can see. Trying to learn them...
Thanks, @FawnLocke and @MasterQuiz!
 
It's the same with array operands, just the other way around
⋄ 1{⍺}0
 
@AlexB Notice also that it's +/ and not /+
 
@FawnLocke 1
 
@FawnLocke Did you mean functions?
 
8:03 PM
No, it's hard to clarify in a short sentence. Not related to this misunderstanding, (but related to the larger conversation) you can read about operator syntax here: help.dyalog.com/latest/Content/Language/…
You can use operands of either association but a monadic operand must always be present. Although I don't see much purpose in doing it this way
 
I understand all this, but I did not understand until now that the associativity of a user-defined operator cannot be changed by playing with double-alpha and double-omega. It probably has to do with ambiguity during parsing. (If operator associativity sometimes were on the right, there could be situations that the parser cannot disambiguate.)
 
@FawnLocke What are you replying to?
 
@MasterQuiz This
 
@FawnLocke Isn't {⍺} a function?
 
Yes, I was trying to get across that you can create a function only referencing the dyadic operand, similarly to how you can with operators
but that a monadic operand must be present in both cases
 
8:16 PM
@FawnLocke I didn't get "array operand" before, but I understood the simile
 
@FawnLocke operand argument
 
I see, Dyalog doesn't call array arguments operands
My mistake
 
You might be confusing some things.
⍺⍺ (and optionally ⍵⍵) are always called operands. They may be array operands or function operands.
(and optionally ) are always called arguments. They must always be arrays.
 
Right, yeah
Thanks
 

« first day (1817 days earlier)      last day (845 days later) »