« first day (1825 days earlier)      last day (125 days later) » 

2:51 AM
@Jonah Following roughly your strategy I get 41 chars, not obviously better. My version uses lists instead of units (J's scalar boxes) so I can distinguish if something is positive depth by the rank.
Seems to not be right actually. The depth modifier with a non-homogeneous argument is kind of always a bad idea.
3:11 AM
@Marshall Thanks for looking. Am I right to locate some of the complexity of the J solution in it's non-based-array model?
@Jonah Probably some, since you have to distinguish between boxed array and array of boxes. Actually, looks like your result with 1 1 2 1 is wrong for this reason: the 1 1 ends up with a layer of boxing it shouldn't have.
Ugh, yeah it's wrong.
So in BQN that distinction doesn't exist?
No, lists just contain elements. Anything with depth 0 is not an array.
31 chars; seems to work and is somewhat clean.
3:26 AM
Nice. That's a clear improvement over the J.
Another question about connections to based array model. One quirk of ; in J that's always bothered me is that 1;2 and 1;<2 evaluate to the same thing. Obviously I see why it's designed like that -- because a common use case is to chain ; together, and this special case behavior makes sense for that case. But it just feels wrong. Do you see this as stemming from the same root cause?
No, I could see someone designing the same function in a based model. I guess it's less likely because there'd be no equivalent of 1 2;3 4.
I think there's a connection in treating arrays of numbers or characters as special, but that's sort of at a higher level.
4 hours later…
7:16 AM
@Marshall I rewrote it using recursion to fix the bug you found. Still absurdly long, but it ended up saving a few bytes and I think is conceptually a bit sounder.
4 hours later…
11:27 AM
@KamilaSzewczyk Done — all 770 of them.
@Razetime interval index is best for that sort of thing I think
I've just added Lesson 13 to xpqz.github.io/cultivations
Only 45 to go....
Awesome work :)
Keeps me off the streets.
11:47 AM
@xpqz Shaping up really nicely.
12:12 PM
@rak1507 yeah interval index is but i'm obviously not using that
2 hours later…
1:58 PM
@Adám sweet
@KamilaSzewczyk In researching this, I found out that the DMX values are not unique. This means that for a specific major error number, e.g. 11 (DOMAIN) you could potentially have two distinct errors for which ENX is 1. You have to check the category to be sure. The chance of it happening it probably low, though.
Not the best design, imo. It'd be nice to expose the category numbers (they do exist) and allow trapping specific combinations, e.g (⊂11 1 1): would only trap DOMAIN ERROR: Division by zero
(The first 1 is the category number for "General")
2:15 PM
2 hours later…
4:12 PM
@Marshall Finally got a decent J solution, based off an idea suggested by ovs: <:<@([:>:L:0$:^:(0<{.));.1~1,2~:/\=&1for 37. His BQN implementation is even shorter.
4:34 PM
I've spent a bit of time trying to get emacs working with dyalog on MacOS. I've got dyalog-mode and the fonts working so I can edit files, but getting a connection between emacs and RIDE doesn't seem to be happening. Has anybody gotten this to work with MacOS before I spend more time on it?
@user1130590 I don't think you want RIDE when using dyalog-mode. Problem is that it is complicated to fine the actual dyalog executable under macOS. @xpqz might be able to help. Another option is setting RIDE_EDITOR=emacs which makes RIDE use emacs to edit things instead of using its own editor.
@user1130590 What are you trying to achieve, have emacs actually execute APL code?
@user1130590 In my opinion, Dyalog/Mac works best using RIDE as your IDE. It's an acquired taste, but works really well once you "get it". At the time, I found discovery hard, and many (IMO) basic things I can't see I'd ever be able to discover without help from this chatroom.
With the forthcoming v18.2 you can run bi-directional ]LINK -- in which case external editing becomes less cumbersome.
@xpqz Hm, a book might help with discovery…
But getting a repl or debugging inside emacs is -- sadly -- some way off. There is some work done to implement the language server protocol and debugger extensions which would work both for emacs and vs code (and jet brains and vim, and, and ...). But it's not quite there yet.
I'm having some trouble with grade up/down
21 30 70 60 90 120 120 20 85 75
0.12 0.0145 0.0145 0.0073 0.0065 0.0065 0.0053 0.0049 0.0041 0.0025
2.52 0.435 1.015 0.438 0.585 0.78 0.636 0.098 0.3485 0.1875
1 3 6 7 5 4 2 9 10 8
4:48 PM
What result did you expect?
If I understand correctly, grade down should give me indices from the largest to the smallest; but if this is the case, it's telling me 0.78 < 0.636 ?
Also 0.3485 < 0.1875
So I clearly don't understand something
Yes, it is the inverse of what you think.
@user1130590 But, as @Adám notes, Dyalog's installation approach on the Mac isn't external tool-friendly. For now. An increasing number of Mac users are highlighting this to Dyalog, which is good.
It is telling you that the largest number is the 1st one, the second largest number is the 3rd one, etc.
Oooooh ok
4:51 PM
If you want their ranking, use ⍋⍒
@xpqz Yes, that was the idea. I'm a two week newbie with RIDE/dyalog, but I've been using emacs for a really long time.
Now that makes a lot more sense
@xpqz Thanks xpqz. I have watched your recent video which is what made me realize that I might be barking up the wrong tree. I'll just stick to RIDE for now.
@bwanab I'd stick my neck out and say that requires a boatload of work, and likely implementing the RIDE prototcol or the LSP, or some translation layer between. I can point you to Gil's PoC for VS Code if you like.
Hmmm, so if I have a namesB and I want to get the largest qty×rate, I can use namesB[⊃⍋⍒qtyB×rateB]
Is there a better way to do this?
4:58 PM
@AndréLeria Well, depends how namesB corresponds to the other two variables, but if they are in the same order, then namesB[⊃⍒qtyB×rateB] or ` namesB⊃⍨⊃⍒qtyB×rateB should do the trick.
Yes, the names and values are following the same order
@bwanab You can see what Gil did here: github.com/tiamatica/vscode-apl-debug
Ok, thanks
Does ⎕WC work well on Linux?
The documentation I'm reading has a few erroring examples, could be my fault though
Yes, but obviously, it cannot create WinForms.
5:05 PM
Ah, okay
Could you give an example of something that errors?
Maybe APLcart should say "(Windows only)" one the relevant objects?
i.imgur.com/enf97YI.png Sure, I don't understand what's happening here. I was just testing examples and was wondering if ⎕WC is viable on Linux, that's been clarified now though
The first line errors
@Adám That'd be nice. I did search the aplcart to look for Windows only
A Form is literally a WinForm.
Ah, I'm not familiar with windows terminology so /shrug
@Adám Would a function defined as solve ← (⊃⍨∘⊃∘⍒) be a good solution, in this case? As in names solve qty×rates
5:15 PM
Yes, that seems fine to me, although I'd either leave out the parens or write it as the dfn {⍺⊃⍨⊃⍒⍵}
Oh, I thought the parens were required when defining functions this way
@Adám Other than HTMLRenderer, is there anything ⎕WC does that is not windows only?
TCPSocket, Timer…
Does Timer work on linux?
Ah yes.
Is it just hose three things - I don't thinks the docs have a list anywhere.
I wonder if NetClient, NetControl, NetType work.
5:31 PM
I wouldn't think NetControl would work, given its purpose is to put a .NET control on winform.
I pretty sure .NET core does not include forms
Right, but NetClient is equivalent to ⎕NEW so it should work.
@FawnLocke Done.
Now APLcart needs a way to do negative searches, ⎕WC not(Windows only)
5:46 PM
{⎕←'time is','s',⍨+/1 1000÷⍨¯2↑⎕TS ⋄ ⎕DL ⍵}⍣≡&1 when I run this, it gradually slows down, ending up taking several seconds between messages, is that true for other people?
and if so what causes that?
      {⎕←'time is','s',⍨+/1 1000÷⍨¯2↑⎕TS ⋄ ⎕DL ⍵}⍣≡&1
time is 38.358 s
time is 39.418 s
time is 40.523 s
time is 41.691 s
time is 42.908 s
time is 44.193 s
time is 45.534 s
time is 46.945 s
time is 48.437 s
time is 49.995 s
time is 51.622 s
time is 53.321 s
time is 55.076 s
time is 56.889 s
time is 58.76 s
time is 0.71 s
time is 2.743 s
time is 4.859 s
time is 7.061 s
time is 9.341 s
time is 11.715 s
time is 14.203 s
time is 16.795 s
time is 19.475 s
time is 22.289 s
time is 25.251 s
the gap gradually increases
@rak1507 ⎕DL returns the actual elapsed time, which is a little longer than the requested time, so ⎕DL ⍵ asks for a longer and longer time.
oh, that makes sense, thanks
Btw, have a look at ⎕DT (and maybe 1200⌶)
seems like ⎕DL has about 60 ms of overhead
which seems like quite a lot for something as simple as delaying? but maybe it's more complicated because of the threading
Yeah, ⎕DL uniquely allows thread-switching in the middle of a statement.
5:51 PM
@Adám thanks, I used ⎕TS because it was the most basic for getting seconds+ms
@Adám yeah, handy for doing things every x minutes or something like that
Yeah, although a Timer object is an alternative…
@Adám 23.509
Well, actually longer than yours.
true lol
and mine would be shorter again with 1e3 instead of 1000
5:56 PM
But much longer than ⎕←⊃'ss.fff'(1200⌶)1⎕DT'Z' if you wanted padding to a consistent number of digits.
@Adám 38.728
also if I did 1e3(⊥÷⊣)x
I hope we'll be able to write ⊃(⊂'ss.fff')⎕DT'Z' soon.
6:45 PM
@user110569 Hi Steve Allen. If you want to participate here, please email access@apl.chat
7:13 PM
@Adám could you teach me some more about apl?
@Elise Sure. Welcome back. Let me go look where we got to.
@Elise OK, the last thing you did was to divide a bunch of numbers by themselves to get a new list of all 1s: ⋄ ÷⍨3 1 4 1 5
@Adám 1 1 1 1 1
Do you remember how we summed a list of numbers?
No, I don't remember it right now
Maybe I didn't even show you. I'm not sure. Anyway, no worries.
We used ⋄ +/3 1 4 1 5 for the sum and ⋄ ×/3 1 4 1 5 for the product.
7:22 PM
The idea was that we took a dyadic (two-argument) function like + or × and gave it to the operator / to produce a new related function which was equivalent to sticking that function between all elements.
Can you see how we might (in a rather cumbersome way!) count how many numbers there are in a list of numbers?
Is there a way to 'silence' a )load to not print the welcome message?
@xpqz Use ⎕LOAD
@Adám I can't think of any way to do that
@Adám That seems to still print it. I can do ⎕CY of course.
7:27 PM
@Elise If we convert every number to a 1 then the sum of those 1s would be the count of numbers, right?
@xpqz Oh, now I get what you want. It isn't the blah blah saved… message you want away, it is the automatic execution of ⎕LX. In that case, use )xload
⋄ +/÷⍨3 1 4 1 5
@Elise 5
@Adám Ah I see -- didn't realise they were separate things.
Now remember that every function, including +/ takes as right argument, whatever is to its right. In general, this means you can add more code on the left.
@Elise Bravo!
@xpqz Added some keywords to APLcart.
⋄ 1/3 1 4 1 5
7:31 PM
@AndréLeria 3 1 4 1 5
Ok, I just learned the / better, I think
⋄ 5 / 1
@AndréLeria 1 1 1 1 1
@Elise Are you ready for learning how to create a real program?
Yeah sure!
I'm sorry for intruding, but I'm interested on what a real program would be
7:35 PM
No worries. Just defining a function rather that writing expressions for immediate execution.
Oh, interesting
OK, so in the simplest form, we can take an expression and wrap it in curly braces, but substitute the argument with
E.g. we can take the expression +/÷⍨3 1 4 1 5 and wrap it to {+/÷⍨3 1 4 1 5} then substitute the argument: {+/÷⍨⍵}
This is actually a real APL program. We'd call this a user defined function. This particular form, using braces, is specifically called a "dfn" (pronounced "DEE-fun").
We can either use it inline: ⋄ {+/÷⍨⍵}3 1 4 1 5 like any built-in function, or give it a name and then call it: ⋄ Count←{+/÷⍨⍵} ⋄ Count 3 1 4 1 5 ⋄ Count 2 7 1 8
I don't remember if I've shown you for giving things names, but there you go :-)
We can give the data a name too: ⋄ myNums←3 1 4 1 5 ⋄ Count←{+/÷⍨⍵} ⋄ Count myNums
@Adám 5
7:40 PM
I like to name my data (arrays) with a lowercase initial, and my functions with an uppercase initial. It isn't required, but I find it easier to read code that way.
What are arrays?
Ah, glad you asked.
In APL, all data is kept in arrays.
An array is simply an ordered collection of data elements.
In order to pin-point a particular element in a list (which is an array) you'd use a number, called an index.
E.g. in the list 31 41 59 the number 59 is at position 3.
However, arrays can be more than just lists. Consider e.g. this table of numbers:

@xpqz Please don't.
 2 8 5 6
 3 1 7 7
10 4 6 9
Here, in order to point out where the 4 is, we'd need to indices (plural of index).
@Adám It's a beautiful thing.
7:49 PM
@xpqz It is a horrible thing that should have been burned with fire long ago.
The 4 is on row 3 at column 2
@xpqz I can see why that works, and I can see potential (bad) uses of it
What, like magic globals springing into existance, effect-at-a-distance? Endless hours of fun.
If you want to address something outside the dfn's scope, use a namespace for it, e.g. {#.x←⍵} or {⎕THIS.x←⍵}
If you want to update something, use x⊢←
@Elise Sorry for the intermingled conversations ;-)
I know I know...:)
So, lets say we want to extract the 59 from the list 31 41 59
We have a function for that: (it is on the APL key with Shift+L)
⋄ 3 ⌷ 31 41 59
7:52 PM
@Adám 59
@xpqz a local var entangled with a glob... ha ha
If we have the above table ⋄ mytable←3 4⍴2 8 5 6 3 1 7 7 10 4 6 9 we can get the element on row 3 at column 2 with ⋄ 3 2⌷mytable
@Adám 4
@Elise Makes any sense?
What does the rho do?
7:55 PM
@Adám Is there a difference between dyadic ⊃ and dyadic ⌷?
@Elise The Rho function, which is like the Latin/English letter R is for Reshape. It reshaped the flat list of numbers into a table with 3 rows and 4 columns.
@AndréLeria Yes, but not when the left argument is a single number and the right argument is a flat list.
I see
How can I use the shift L? It doensn't write the ⌷ when i try it
Do you have a way to type APL characters?
No, i just copy paste them
8:01 PM
Aha, if you're just going to type in the browser, then have a look at abrudz.github.io/lb/apl
Assuming you're using a common browser on a computer (not a phone or tablet), it should be fairly easy to "install".
@Adám back on the topic of CPF validating: I'm researching the validation side of it. so far, considering a VDs function (Verification Digits) that takes the first 9 digits and generates all 11 digits, I wrote a validate function as {⍺≡VDs 9↑⍵}⍨
Once you have that language bar, you can either click symbols to insert them into chat, or use e.g. `L to type
It seems to work, but I don't know how good this code is. May I ask for how good is this code?
No need use with to copy over the argument to the left. Just use twice.
Oh, true
That was reminiscent of trying to make it tacit at first
8:08 PM
Tacit would be ⊢≡∘VDs 9↑⊢
Then I gave up and went back to dfn, but kept the ⍨ there
So the ⍨ would never solve anything in this case
Technically, you're doing a bit too much work, comparing the first 9 digits too. You could use ≡⍥{9↓⍵} which applies after pre-processing both its arguments with {9↓⍵}
@AndréLeria You could do ≡∘VDs∘(9↑⊢)⍨ but that's hardly better.
Yes, the language bar is here now
Great. No for (kind of) a trick question…
In the table, we needed two indices to pin-point a specific element.
In the list, we needed one index to pin-pint a specific element.
How many indices do we need to pin-point a specific element in a single number, e.g. 5?
8:12 PM
Absolutely correct. A lot of people struggle with that.
Now, all collections of data are arrays. Some might be single numbers (we call those scalars), some are lists (we call those vectors), some are tables (we call those matrices — plural of matrix) and there are even more.
The number of indices necessary to point at an element is also called the array's "rank", or "number of dimensions".
Scalars are rank-0 arrays. Vectors are rank-1 arrays. Matrices are rank-2 arrays. Rank-3 arrays and rank-4 arrays etc. also exist, but they don't really have specific names in English.
Btw, while we've been dealing with numbers, the same applies to any atomic pieces of information, e.g. characters. A single character is a scalar. A list of characters (sometimes called a "string") is a vector, and we can have character matrices too.
Here is a character matrix: ⋄ ⎕←3 5⍴'EliseQuickStudy'
Now, imagine this matrix was called text. How might we extract the d?
If you would have a rank 3 array, how would you point out in which layer of the list it is? I would assume it would have a second layer above, like two matrixes
Of course it would. Let's ask APL to print one for us: ⋄ 2 3 5⍴'EliseQuickStudyLearnCodesToday'

8:20 PM
⋄3 4 ⌷ 3 5⍴'EliseQuickStudy'
@Elise d
Oh, wrong symbol. Hold Shift to make not the wider
You can press UpArrow to fix you code, then Enter.
Also, you need the 3 5⍴''
There you go!
And if you wanted to point out a layer, you'd just add another index in front: E.g. the n in our rank-3 array: ⋄ 2 1 5⌷2 3 5⍴'EliseQuickStudyLearnCodesToday'
@Adám n
2nd layer, 1st row, 5th column.
I see, that's clear
8:25 PM
Great. Again another thing people tend to struggle with, so you're really doing great.
Btw, the Rho function can (just like -) take either one or two arguments. When given two arguments, it reshapes, as we've seen. When given one argument, it just returns the shape: ⋄ ⍴'Hello'
@Adám 5
So we don't really need to define a function to compute the length of a list!
For a higher-rank array, it returns the size of each dimension: ⋄ text←2 3 5⍴'EliseQuickStudyLearnCodesToday' ⋄ ⍴text
@Adám 2 3 5
This gives us the shape of the array argument. How would we compute the rank of the array argument?
@Adám So validate←⊢≡⍥(9∘↓)∘VDs 9↑⊢ would be the tacit version?
8:34 PM
That's one way to do it, yes.
With ⍴⍴(the number/letters)? Like you count the shape of the numbers/letters, and then you count the amount of numbers in that
Nice, thanks
I reached the Over lesson of APL just yesterday, and loved it
@Elise I'm impressed. You nailed it!
I'm not joking. You've really got a knack for this.
Do you think you could define a function Elements that would compute the total number of elements in an array of any rank?
Thank you!
This improvement seems impressive indeed
@Elise do you have any background on other programming languages? Something tells me APL is one of your first programming languages, if not the first
You seem not to have the "barrier" that other paradigms hold
8:38 PM
I indeed haven't done any programming before
@AndréLeria I might instead define the function to compute a single check digit CD, without appending it to the input, then write 9∘↓≡∘CD⊢,CD
@Elise That confirms it. Anyway, congratulations, you're learning quite fast as Adám said
@Adám That makes more sense
@Elise Let me know if you need any hints for the Elements task.
Sorry, i hadn't seen that message yet. Is it ×/⍴(the numbers)?
It sure is. Wow.
Now do you remember how we'd make this a proper "dfn" so that we can use it over and over?
8:49 PM
⋄Elements ← {×/⍴⍵}
Almost. You're just missing the curly braces.
@Elise Response looks like a 0-by-0 matrix.
The bot is complaining, because you're using outside braces. Now the bot's cryptic response is because you've just named a function, without using it. Everything is alright.
Btw, the bot's response is interesting. It alludes to the fact that dimensions can have length 0, which renders them practically invisible, but they are still, there, and could potentially be enlarged later.
I will have to be going now, but thanks a lot!
Sure, now problem. See you around!
9:00 PM
I made the following solution to check wether a character vector starts with a Capital, consist out of only capitals or is completely lower case
{((+/⍵)=0) ∨ ((+/⍵)=⍴⍵) ∨ ( ((+/⍵)=1) ∧ (⊃⍵) )}{⍵∊⎕A}¨name
But I think it is ugly...
@Richard The very least you can do is get rid of that ¨
I can kip a pair of braces but is for making it more clear
how about {(+/⍵∊⎕A)∊0 1 (≢⍵)}
nope nvm
(+/⍵)=⍴⍵ is just ∧/⍵
@Adám oh yes
9:02 PM
((+/⍵)=0 could be 0=+/⍵, or ~∨/⍵
:) yes thanks
((+/⍵)=1) ∧ (⊃⍵) could be ⍵≡1=⍳≢⍵ (or 0= if ⎕IO←0)
{(⊂⍵∊⎕A) ∊ (≠⍨⍵) (=⍨⍵) (1↑⍨≢⍵)}
@Adám you beat me to it
(∧/∨(~∨/)∨⊢≡⍷⍨)∊∘⎕A which can be simplified at the cost of readability:
This is probably as efficient as it gets, without short-circuiting.
{⍵≡⍷⍨⍵:1⋄~∨/⍵:1⋄∧/⍵}∊∘⎕A with short-circuiting.
9:12 PM
the first character is irrelevant so it can be simplified to either all or none of 1↓⍵ are caps
oh, nvm that wouldn't work for aBCD
      words←{(⎕A,⍨⎕C ⎕A)[?⍵⍴30]}¨3+?1000⍴3
      words←{(⎕A,⍨⎕C ⎕A)[?⍵⍴30]}¨3+?1e6⍴3
      ]runtime -c NSC¨words WSC¨words

  NSC¨words → 1.2E1  |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  WSC¨words → 1.6E0  | -87% ⎕⎕⎕⎕⎕⎕
      words←{(⎕A,⍨⎕C ⎕A)[?⍵⍴30]}¨3+?1e3⍴3
      ]runtime -c NSC¨words WSC¨words

  NSC¨words → 1.0E¯3 |  0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  WSC¨words → 1.1E¯3 | +3% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
Oh, the above measurement with a million was a fluke. It doesn't seem to matter much.
And the non-short-circuiting version is much nicer.
9:34 PM
((∨/0@1)≤∧/)∊∘⎕A - same length
@dzaima (∧/≥1∊0@1)∊∘⎕A
imo, it would be more beautiful as (∧/≥1∊~⍢⊃)∊∘⎕A
except that that doesn't work (and is doable with ~@1 anyway)
9:40 PM
Oh, of course it doesn't. D'oh.
We'd need =⍨⍢⊃
@dzaima Fails on ''
ah yeah it would
I think I have the craziest solution ever.
@Adám (∧/≥1∊1↓⊢)∊∘⎕A fixes that
Yes, and that's much better anyway.
9:57 PM
@Richard Nah, that's nothing. Here's my candidate for worst APL solution ever:
      {((d←⎕NS⍬).en←⎕NS⍬).WeekdayNames←7⍴⊂⍵ ⋄ ∨/⍵≡∘{⊃1(1200⌶)⍠'Dictionary'd⍨⍵/'Dd'}⍤1⊢5 5 5⊤105 19}¨'ABc' 'abC' 'aBC' 'Abc' 'abc' 'ABC'
0 0 0 1 1 1
@Adám Don't completely agree. The ¨ was stupid. And shows i'm still not thinking in matrices.
@Adám that makes me at least smile :)
Bonus challenge: Understand how my abomination works.
That will keep me busy for a while...

« first day (1825 days earlier)      last day (125 days later) »