« first day (1328 days earlier)      last day (1327 days later) » 

1:33 AM
@Marshall Bit of an undercount: after going through the compiler again, I'm up to 32 uses of « and », which is more than pairs ⍋⍒ and ↑↓, or any of ∧∨<> individually, but not in pairs. Surprisingly, I only ever used Rotate as a substitute for shifts, in cases when I knew there was a 0 on the other side. So Rotate is no longer used in the compiler.
 
 
2 hours later…
3:04 AM
⋄ {¯1∘↓⍣('/'=¯1↑⍵)⊢⍵}'test/'
 
@TessellatingHeckler RANK ERROR
 
it works (drops the trailing / if there is one) if I put a hardcoded ⍣0 or ⍣1 and ('/'=¯1↑⍵) is always 0 or 1
... what does RANK have to do with it
 
<moon-child> ⋄ ⍴ '/'=¯1↑'test/' ⋄ ⍴ 1
1
0 ⍴ 0
<moon-child> '/'=¯1↑⍵ is a vector, but ⍣ wants a scalar
<moon-child> ⋄{¯1∘↓⍣(⊃'/'=¯1↑⍵)⊢⍵}'test/'
test
 
It's somewhat unexpected for Dyalog APL because it usually treats all singleton arrays the same when the shape isn't that important
 
<moon-child> golfed: {⍵/⍨~⌽×\⌽⍵='/'}
<phantomics> Does APLBot crosspost from another place?
<moon-child> phantomics: yes, stackexchange chat; chat.stackexchange.com/rooms/52405/the-apl-orchard
 
3:21 AM
@moon-child Even better: {⍵↓⍨-'/'=⊢/⍵}
Tacit: ⊢↓⍨∘-'/'=⊢/
10 chars: ⌽⌽↓⍨'/'=⊢/
@Adám Is it intended that doesn't accept non-scalar singleton right operand?
 
@DyalogAPL ahhh, thanks moon-child
 
@TessellatingHeckler A nice way to get the last element of a vector as a scalar is ⊢/.
 
⋄ ⌽⌽↓⍨'/'=⊢/ 'test/'
 
@TessellatingHeckler 0 ⍴ 0
 
⋄ (⌽⌽↓⍨'/'=⊢/) 'test/'
 
3:35 AM
@TessellatingHeckler test
 
oh yeah train parens
 
3:52 AM
is there a logical not in apl?
 
@Razetime ~
 
@Bubbler ima write that down
 
Except that it only accepts 0 or 1, as opposed to many other languages.
 
yes, I'm using it on a boolean array thankfully
 
Also you can always APLcart
 
3:55 AM
yep
I'm trying to make a function foor multiplying an ⍳⍵ range with itself mod ⍵
 
Outer product?
 
like each of the elements multiply each other
 
⋄ (⊢|⍳∘.×⍳) 5
 
@Bubbler
1 2 3 4 0
2 4 1 3 0
3 1 4 2 0
4 3 2 1 0
0 0 0 0 0
 
(⍵|⍨⍳⍵)×⍳⍵
something like this
 
3:58 AM
I don't see why you would want to do that
 
I want to sum factors
{+/(~⍵|⍨⍳⍵)×⍳⍵}
 
Oh, OK, but ~ won't work there because the remainder can be greater than 1.
 
yeah, 0= should work
 
Right.
 
just got a domain error a second ago
 
4:01 AM
⋄ {0=⍵|⍨⍳⍵} 12
 
@Bubbler 1 1 1 1 0 1 0 0 0 0 0 1
 
⋄ {⍸0=⍵|⍨⍳⍵} 12
 
@Bubbler 1 2 3 4 6 12
 
Magic.
 
aha!
So to check if a number is an integer, I tried (⌊=⊢)
 
4:12 AM
That works, but there are alternatives like 0=1|⊢ and stuff, which can be golfier or not depending on the surroundings.
 
4:33 AM
@Razetime APLcart is good for looking up simple tasks. Sum of positive divisors comes up as +/∘∪⊢∨⍳, with a TIO example
 
@Bubbler It is reserved for a future extension, to allow multiple values.
 
 
1 hour later…
5:44 AM
@JoKing I generally use APLcart if I have no clue how do do something. I mainly aim for the shortest answer I can make myself first before attempting golfs.
 
6:13 AM
@dzaima does dzaima/APLP5 allow imaginary coordinates?
 
@Razetime no, you have to do the math yourself
 
hmm
I was wondering if I could make a hilbert curve in it
 
7:21 AM
@Adám how do you test multi line snippets of code like in your 2048 program?
 
@Razetime It is a full program (not just a snippet), and the entire program is wrapped into a tradfn so that it can be run multiple times.
∇f
'some program here'
'some more program here'
∇
Then f is called on its own line, and the input (if any) is entered on next line(s), one input ( or ) per line.
 
@Razetime ^ putting ∇f in the Header and in the Footer, and then in Input, I call ⠀⠀⠀⠀⠀⠀f followed by line(s) of input (if any), then another ⠀⠀⠀⠀⠀⠀f and its input.
 
7:42 AM
whats the best way to run a full program locally?
on the Dyalog IDE, I mean
 
@Razetime Enter the program's name :-)
Header/Code/Footer corresponds to things you'd type into the Editor. Input corresponds to what you'd type into the session (REPL).
 
@Razetime Without using a source code file, IMO the best way is to define a tradfn, just like on TIO.
 
@Bubbler Even with a source code file, it is the only way.
 
@Razetime iirc )ed whatever and paste the source there (with the ∇s) and execute that name in the REPL
 
Or simply paste the source code (with s) into the REPL.
 
7:52 AM
@Adám ah right
 
:-D That was originally the only way.
 
@Adám Wait, does that mean we should change the way we score full programs in code golf?
 
@Bubbler No, it seems consensus is to ignore ∇f and . Certainly, the s don't need counting, as they are actually REPL commands, not part of the source (verify with ⎕NR'f'). I can see a point that "f\n" should be counted, but unless you're using flow control, one could just enter the lines into the REPL (with diamonds, prior to 18.0). Adding 2 bytes to the flow-controlled cases would complicate matters.
 
Technically, if the interpreter can't accept the exact source code, it is invalid.
But then there comes one could just enter the lines into the REPL and APL is historically a REPL language...
 
8:08 AM
oh, i can open files. facepalm
 
@Adám Just curious, how hard would it be to allow control structures in the REPL?
 
8:35 AM
@Bubbler Sorry, I meant . Control structs are already allowed (in 18.0). And even works if you switch to multi-line mode using :Section
 
RGS
9:05 AM
I was slightly thrown off by ⋄ ⎕JSON ⍸3 but that really is the intended result, right? because it sees the single 3 as a scalar..?
 
@RGS [[],[],[]]
 
@RGS Right, it gives N copies of each position in the array, where N is the value at that position. Scalars have only one position, so it gives 3 s.
 
9:51 AM
I guess that can be a very short way of creating an array of length n
 
@JoKing Does it improve over ⍳n?
 
¯\_(ツ)_/¯
@Adám Maybe in specific scenarios
 
⍸0 is certainly shorter than 0⍴⊂⍬
 
I can imagine wanting to get the nth element of some sequence where each element is an array building off the previous element, starting with the empty array, and you could do something like f∘⊣/⍸5
 
Sure.
 
10:02 AM
@JoKing i guess in the case of repeating n-1 times starting with an empty array f⍤⊢/⍸ is better than {{⍵,1}⍣(⍵-1)⊢⍬} but that's probably a rare enough thing
 
@dzaima It has the advantage of being easier to put in a train... but yeah, I'd prefer
 
@dzaima (s/{⍵,1}/f)
 
 
2 hours later…
11:40 AM
heh; noticed while trying to figure out what to do with {2×↩𝕨} assertion-erroring in dzaima/BQN
@dzaima (correction; {x×↩𝕨}; but that assertion-errors too)
@dzaima so turns out that the expressions a↩𝕨 and a←𝕨 is marked as possibly-·, despite never being so, and that's why those worked. modifying assignment skips the type copying (due to always being array), and so broke
@dzaima ah. :P
and with that, i think i have multidimensional working
 
 
2 hours later…
1:59 PM
@Adám Nice! (spent a while wondering who the next "guest" is). From it I've just seen that 1⊥ appears to be the same as +/ from the Ohm's law example.
 
@TessellatingHeckler Yeah, you're number two to complain about that.
 
2:12 PM
@dzaima and also implemented » and «
@Marshall the assertion here (and correspondingly in dzref) is incorrect (i.e. (3‿3⥊0)«1‿2‿3)
i assume that was supposed to be a not a
 
@dzaima Just removed those from dzref so they were only in spec/reference.bqn. I fixed that one though.
I found another interesting use for Shift Before. Take doesn't let you specify a fill element, but if you're taking along the first axis and want to fill with a constant value then you can make an array of the fill with the shape you want and then shift in the array to overtake as the left argument. Example.
 
2:34 PM
heh (0‿1‿1‿2⊔"abcd")»/4
 
2:47 PM
pushed better errors when the cause doesn't provide the blame, and cancelling compilation to java when the bytecode is too large (so no more •compstart←¯1 required for tests)
should probably make tokenize-time errors get pretty messages too
@dzaima that was quite easy, no clue why i didn't do it before..
 
@dzaima I think I'm going to add the extension you suggested with an extra value in the left argument for the length though. When you're computing 𝕨 with +` it's inconvenient to get the final shape but easy to tack on a 0 before the sum.
 
 
4 hours later…
6:38 PM
@Marshall missing commas in the xkb file for «»
 
@dzaima Is it all right now?
 
@Marshall yep
 
7:25 PM
@Marshall Have you made the connection between the roles of variables in BQN and roles in Perl? The f vs F very much reminds me of $f vs @f contexts.
 
@eyepatch I've written approximately one Perl script ten years ago, so no.
 
So, in perl, which I'm only marginally familiar with, you might have an array @array, but you can evaluate that array in an array context, in which case you would refer to it as @array, or in a scalar context, where you would refer to it as $array. There are additional contexts like for dictionaries %. These contexts are indicated by sigils. This is why in perl code, you might see my @arr = ( "a", "b"). if ($arr > 0). It's the same variable in different contexts as indicated by the sigil.
That's my overall understanding. I assume you see the connection to array and Array
 
@eyepatch Yeah, that's fairly similar. It looks like the thing that a sigil applies to can be somewhat larger than an individual variable, such as $array[index] to get a scalar element of an array.
If I'm reading docs right it looks like "context" is actually something that comes from outside the expression, so that for instance the conditional in an if statement is in a scalar context. In BQN you can either use a particular role in some position or not; there's no outside context that would modify what it means.
 
7:44 PM
I think it's beyond my current understanding, but sigils do impact the way that something is evaluated.
Any reason for ↕ instead of iota?
 
@eyepatch I removed all the greek letters, and script characters in general.
More visually consistent and doesn't cause confusion with actual greek letters.
 
I guess it's more internationalization friendly.
 
Although I may contradict myself and use for Complex in BQNs with complex numbers. That's why it's on the keyboard (on P).
@eyepatch See List value constructors for a fairly drastic example of outside context affecting meaning. "In a context not requiring a list value, the value of what appears to be a list literal is simply the value of the final element, as with the C comma operator."
 
@Marshall
has better use of the character space, but is confusable with .
 
@Adám That makes some sense. I kind of want Complex to have a more distinctive symbol, but I'm also not sure there's any reason it should be seen as "special" relative to other scalar functions. It is just addition and multiplication.
 
7:59 PM
I'm not sure I understand what you mean by outside context, and I'm not advocating for Perl's rules. It just seemed relevant and something to consider stealing ideas from, but leaving behind undesirable ideas.
 
> plays the same role as - for integers and ÷ for rational numbers.
@Marshall would be the next in the progression, of course, but it makes me think too much of making things smaller (like - and ÷ with >0 and >1 right args, resp.) when it really makes them bigger (with >0 right arg), so maybe ?
 
@Adám I would say those are more like , , or "solve polynomial", really.
Subtraction and division are both things that are reasonable to apply to natural numbers but aren't always defined within that domain. Complex really only makes sense if you already know complex numbers are useful.
 
I have nothing to add to this discussion other than please use i not j
 
@rak1507 i rather than j is already part of the numeric literal rules.
 
:D
 
8:50 PM
@Marshall fyi you're using 0j1 there
 
@dzaima Okay, now there aren't any j's in the whole document.
Going to disallow exponents for while I'm at it.
 
@Marshall ∞e¯∞ is interesting though.
 
@Adám I hope you mean that in a bad way.
 
Well, W⍺ answers "(undefined)" and nothing else. I don't think I've ever seen that behaviour.
 
If you treat it as a limit, it can be anything from 0 to ∞ depending on how you approach the two infinities. Usually 0 though.
 
9:05 PM
Huh, W⍺ also doesn't know how to compute 1*∞ (1^∞). I don't see any reason why that shouldn't be 1.
 
Fortunately already wasn't allowed in exponents, which can only be integers.
@Adám JS BQN (inheriting from Javascript) also gives NaN for 1⋆∞. But x⋆∞ is 0 for x<1 and for x>1. I also can't see why 1 would be wrong.
 
J and NARS2000 give 1.
 
9:31 PM
@Marshall Uh, what JS engine do you have giving NaN for 1^Infinity?
 
@Adám Both Qutebrowser on Blink and Firefox return NaN for Math.pow(1,Infinity) on my machine.
The literal ^ is xor.
 
Oh, silly me. Yes, 1**-Infinity does too.
 
Of course, defining xor on floating point numbers at all is a pretty strange decision.
 
10:21 PM
5
Q: Why would $1^{-\infty}$ not be 1?

AdámIt would seem to me that $1^{-∞}=\lim_\limits{x→∞}1^{-x}=\lim_\limits{x→∞}\frac1{1^x}=\frac11=1$ no matter how we approach it. However, Wolfram Alpha answers with a mysteriously unqualified “$\text{(undefined)}$”. Similarly, JavaScript also thinks that the result isn't a number. On the other hand...

 
 
1 hour later…
11:42 PM
hello everyone
 

« first day (1328 days earlier)      last day (1327 days later) »