Back to Index

APL study session 3


Chapters

0:0
1:13 Recommendations on Air Purifiers
1:40 Cadr Calculator
8:8 Complex Numbers
17:25 Github Pages
21:3 Github Actions
27:0 Git Status
29:18 Github Workflows
31:0 Raw Cell
31:4 Create a Raw Cell
32:9 Collapsible Headings
33:12 Functions
35:13 Create a Function
37:24 Pattern Matching
42:50 Strings
54:11 Anonymous Function without Assignment
59:57 Row as Repeat
66:28 Index Generators
70:7 Higher Ranked Matrix

Transcript

I have all. Yeah, I said now I understand why you're looking up like this. I will move you down to my level. There we go. Alrighty Hello everybody. Hi Wayne, how are you doing good. How are you doing, I feel a little better today. Yeah, the fever has gone away, I hardly ever get home here anymore because we filled our house with air purifiers, which do a great job but something got past them yesterday and I just.

So now I feel like a bit flat after a day of feeling bad you know the next day you kind of like, yeah, you know, apl will cheer me up in the company of you folks. Do you have any recommendations on air purifiers I know there's like the Dyson formaldehyde ones and molecule and all this kind of stuff but I haven't seen any do I of course I do.

I'm all about air quality. So, there's a basically if you Google for like, let me try to think. That tells you the clean air delivery rate that you'll need basically to get a certain number of air changes per hour, which is a CH. And like if you aim for, I don't know like five to eight air changes per hour is being pretty good, then you just type in your room size into one of those online CDR calculators clean air delivery rate calculators and it'll tell you what's the idea you need.

I think it's just a case of buying air purifier that has that CIDR and and a HIPAA HP a filter. It's like, it couldn't be less high tech. It's literally like a piece of woven cloth, which with a fan that blows air through it. That's what an air purifier is.

So, I got this thing called the, the you it's like a sense like I was interested to know air quality and I discovered the CO2 was way too high just because closed windows and things. And so, definitely that's easy right you have to ventilate there's no solution, other than scrubbing.

Yes, you need it, you need. Yeah, so I, I had, I went through that last year, or the year before with the wildfires in California. It was up all the windows and everything and, you know, the process I was worried about like oh is that going to be bad and I bought a CO2 monitor and I discovered our CO2 was like 1800, you know when the maximum recommended.

Yeah, you get headaches and you feel like an idiot, and so ever since then I've been pretty careful about CO2. That that's separate of course you know you can have perfectly good CO2 but still bad air quality if there's one thing that I have is quite high T box that are unpredictable like so I don't know if it's the sensor figure out.

Okay, I was just gonna say I don't know if anyone has any experience with that because I haven't been able to figure it out I've been collecting data for months now and I can't really figure out any clear correlation with the T box. But they sometimes are quite high and I suspect it affects you know sleep and things like that so I do know there's some sensors on the market so I just don't know if that's something you already looked into.

Yeah, I mean, I've got air purifiers which have gas and particle sensors on them. And so then they have an auto mode where they'll go, go harder if there's more stuff. I don't find they seem to correlate with my hay fever though honestly so my method of setting the fan level is if I start getting hay fever I turn it up.

I don't find the auto seems to work that well for me. Okay, yeah, that's definitely been a life changer for me is getting plain air in my house that's basically the first bad hay fever I've had in like 18 months, and it used to, you know, be like the single biggest impact I reckon on my quality of life was really crap all the time.

That's a bit of a side, interesting aside, nonetheless. Any interesting API discoveries since yesterday your questions or anything else. Really, it's fine. It's remarkably hard to do simple things. Yeah, well I mean we just started right so that's. Yeah, post shockingly hard to load. I posted. I posted the forms of basic kind of genetic algorithm, which was pretty cool but I saw that I think I think basic is a is not a fair description I mean compared to where, at least I'm up to.

It looks pretty sophisticated feel like there's a lot that can be done to transform it into a more kind of array based solution then. Well that'll be an interesting project for us all to try to help with I think yeah I mean we're not close to knowing all the glyphs that you're using yet.

I think we've got some catching up to do. My, my goal, my goal is to implement connect for I've implemented it in so many languages and it seems a good enough problem that is non trivial. Yeah. So like with an AI that you play against. Yeah yeah yeah just mini max.

Okay, kind of implementation there's a good gaggle competition competition on that one going on since a while, which is fun. I think I could try flooding in a genetic algorithm to try to optimize it as well that'd be cool. Yes. But just like the simple the board and simple.

Yeah, how to best represent the array of the board is already hard. Yeah, I'm not even at a point of thinking about doing anything yet. Oh, I just press the wrong button. I just had a question from topic about. I'm sorry. Oh, I was just gonna say I spent a lot of time the last day, trying to figure out how to load images in the APL just to get the pixel values and it was a lot harder.

No. No, and I asked on the discord. If there was any kind of beginner friendly ways to load it and I got a lot of resources that I had no luck deciphering. Is that on the APL discord dialogue conference that they're having coming up that this is a hot topic that they're going to discuss image processing.

Yeah. Awesome. I wanted to ask, we'll be talking about complex numbers which are super cool. I noticed, they're supported in in torch and pytorch is it is it like deep learning uses. Oh yes, what is that absolutely, absolutely. Yeah, I mean apart from anything else there are there an input format for, you know, for audio for example, we would often represent as kind of magnitude and phase.

And we don't normally have to worry about it, but you can optimize convolutions using Fourier transforms, you know, and using complex representation. And that's kind of handled for us by Cootie and then nowadays but yeah, you know, inputs and outputs as complex numbers is certainly a thing and also if you've got layers that represent some sort of more like, you know, the activations you hope might kind of represent some, something from your domain, they might, you know, be represented well as complex numbers you might have lost functions based on that or.

Yeah. The only time I've used them in pytorch is for audio, but I know other folks use them for other things. I saw that Adam, who actually works at dialogue, and I think he's the guy in arraycast who said he's like used APO his whole life answered some of our questions.

Okay, so once. Okay, so if you use I'm on Mac, not on Windows, but on Windows. Once you've removed some docked windows you can click session save. You can right click on the language bar and hide caption. Once you've got boxing on you can save your session. And yes, I've already saw in the forum to get back ticks with the in browser back to space.

So, that was good to get it on to answer some of our questions. And then the other thing I wanted to mention is that. Was him did some really nice notes which I finally got a note around her reading. And so I get actually highly recommend them so they're linked from the lesson one forum.

So thanks for doing that was him. Am I pronouncing your name right. Yeah. Oh, where's what what where is the name from your South Africa right. So, funny enough, I'm in Sydney at the moment. No way, my parents, but I'm originally from South Africa. And the name is Arabic.

Cool. Welcome to Australia, better than a time zone for you. How long are you here for until the end of next month actually. It's a nice long time. Great. Yeah. If you say hi in the forum if you want to meet up with any fast AI people I'm sure there's, I know there's a bunch of people in, in Sydney.

Yeah, these are great notes. Thank you so much. I love that you've got the juggling notation. Has you come across juggling notation before we discussed it. Not at all. It's interesting isn't it, it's like it was game changing, apparently. And Aaron Hughes PhD. I don't know how you pronounce this name.

You might know, do you know how you pronounce this I guess this is a Chinese name. I mean I know it's not opinion but it's No. Okay. I thought for APL today. Oh, good. There's a link here some thank you. By the way, for those of you who hadn't noticed, at least when I remember or when Serato reminds me, I click on the make wiki, which means that anybody can click edit on these posts.

And so thank you for those of you who have been adding stuff to them. And thinking like in terms of stuff that's going to help us understand more of the documentation and do more things I think there's two main things I wanted to cover today which is left arrow and row.

And basically, do they call it left arrow they do. Okay, cool. So left arrow, which is left square bracket is used to assign names to variables. So, a is three. So, obviously, in a lot of languages, we would use equals for that. But, you know, a statement like x equals x plus one is not a mathematically same statement.

So I'm glad APL does not use equals to mean that. So in other languages, we have to say equals equals to mean that. And I know this is something, you know, the kids I teach found quite confusing we're doing when we're doing Python. So very strange meaning of equals.

So you can absolutely do that, you know, if you've got something called x you can rebind it to its previous value plus one. I mean, let's try it. A plus one. Okay. So if you, if you add a plus sign before that a plus a arrow a plus one.

It'll actually print it out for you. As well. I mean that makes sense doesn't it right because we learned that monadic plus is conjugate now that won't work for a complex number because it will actually give you the conjugate but yeah this is going to return the conjugate of everything to the right.

So assignment is returning its. The assigned value and then taking the conjugate of it will as a result printed out. I think. I think this might be better left attack. That's because that's actually always monadic function same. So, if I replace this with that. And I think you can also, when you start nesting these assignments, these assignments can be, you could create a new variable as part of, you can create a left arrow.

B is left arrow B plus one, A plus one so you can you can actually nest them. Yes, I think if you do left arrow and then the box I forget what it's called an assignment in the box. This quad, which is, is that an L. Yes, yeah. I think if you assign them to that.

That's what they do in the dog usually the mnemonic is you're kind of like saving to the screen. Got it. So that's a special thing to assign to. Yeah, a lot of the IO operations are handled by quad. Great. Now the other interesting thing, which is happening is that Isaac has started creating a website for the study group, which is not quite up and running yet.

Did you do the settings pages that GitHub pages, then GitHub pages branch and all that. Yeah, I think we could just probably do that now so let me. While I remember to get poor. And then, yeah, we should be. So for those of you that don't know GitHub has a very nice feature called GitHub pages, which basically turns a repo into a website.

And to use it. You basically go to pages, and you say sources this branch. And in theory I should now be able to click on this. We may need to. So I can check what's going on by switching to that branch. Okay, so there's definitely something there. I can do a little after I accepted the settings and pages I had to make a small commit to the first time, I've noticed that to remove one character return from here.

And I can vaguely hear. How are you talking I can vaguely hear your ghostly distant voice. Can you hear me now. Oh, there you are. That sounds great. Yeah, it's it's the site is up actually, it's ready. Fastai.github.io/APLstudy. Something I like to do is when I go here is I copy this.

And then I go into settings and paste it here. And that way anybody on my page, including me can jump to the website. I really wish they knew that automatically. Yeah. Look at that. Okay. Thank you Isaac, this is beautiful. There it all is. So, oh, this is cool.

I didn't notice the this thing here automatically pops open the. So this is quarter, which is what nb dev two will be using, which is full of neat tricks. So a lot of a lot of quarters commands are really well designed. Yeah, it really is. It's from our studio JJ Liz company and everything he's done has been great.

He's hired a lot of great people as well. And he's been super helpful. I think we need some image of some APL thing. That'd be nice. It's very cool image there. All right, well that was easy. Yeah, all the images are the quarter defaults. Anybody wants to do a PR which uploads an image of I don't know, a cool formula or picture of Isaac with a little lambda on his head or whatever, you know, all be good.

So the way. Yeah, so the way this works is, as I say basically, I like to do it and it works pretty easily is if you have a branch called GH pages than any HTML, etc. in that branch just ends up as your website. So here's index.html and that's the website.

And now the way that's being created is there's a thing called GitHub actions, which is basically something that will automatically run some code for you when you do things on GitHub. You can use HTML files, of course, because all the cool kids use your more files. And so you say, okay, well, when should this run and it's going to run when you push to master.

Okay, what happens when you push to master? Well, it's going to run a job called deploy, which will run on Ubuntu. So they've got like every major OS with lots of releases, which will check out this repo. So you can run this script. Run this command. And then run this action, which is deployed to GitHub pages.

And I'm guessing I was actually basically borrowed this from the process. It looks similar. Yeah, yeah, I took this from your fast category repository and there's some minor changes, but roughly the same. Yeah, so fast Kaggle I just I just did nb process new and the process is the current name of what will be nb dev to hopefully within three weeks or so.

And as you might have noticed, one nice thing about this is that, you know, we have a Why is this in a separate folder, by the way, Isaac, was that necessary for some reason, or I don't think so. That was the that was how it. The, the default create website porto function did and I didn't structure.

Anyway, yeah, so we've got a notebook here. And that notebook has been auto converted into a post, which is nice. So once you've got this set up, you can start authoring technical blog posts with notebooks really easily, particularly because if you hit dot. I thought if you hit dot, yeah, it's meant to be dot.

Nevermind. You can open up the notebook in github.dev, which is basically a slimmed down online version of VS code. And so I can start editing straight away. I assume that they won't have the APL kernel installed, but I'm not sure you can even run Python, can you? But you can certainly edit the markdown and move cells around and stuff.

Or you could just put markdown files in there. All right, so that's. In fact, let's go ahead and make this a bit simpler while we're here. Otherwise, I might go a bit crazy. All right. So if we move all that into the parent. Then we should be able to remove that.

Yes, OK, we can add this to this document more. So get ignore is the file which contains a list of all the things that weren't that get well by default ignore. So dot quarter. And if you ended up with it, if you end with a slash, it means it's a directory.

OK. All right. Let's move all that. OK, so we should also add that IPY and the checkpoints to our get ignore. Let's check. So then underscore quarter dot YAML is where it's kind of defined. So this doesn't need to be dot slash anymore. Can you think of anything else I might need to change off the top of your head?

Isaac. Thank you. Thank you. Got everything. What does freeze do? Is that different to execute false? I'm not sure, to be honest, the game that was a default setting. I see. All right. So get status will tell us how we're doing here. Oh, yeah. And I was going to add IPY and B.

Check points. Dot I and the check. So I think that is that means it's not going to re-render or rerun file unless the unless it's changed. Makes sense. All right. So we've renamed some things. We've deleted one thing. We've modified one thing. That sounds good. Oh, I haven't got this set up yet.

That's fine. All right. So get commit minus a M. So I will add everything that's not yet added. And M means I'm going to put a message right here. I thought I'd already done that. Oh, that's right. I added that one character. Great. And so now we should be able to go to BASTai.github.io/aplstudy.

And it's still working. How about that? And so something that's useful to know is your GitHub actions when they run. Oh, it didn't work. They get logged here. And so when it breaks, you get across. OK, quarter render is going to change. So that's just no that's not going to need anything anymore.

So we'll change our. I mean, so, you know, just something else to show you. We don't have to like switch to the terminal. We can just go to GitHub workflows and click on here and click on edit. And just edit it directly if we want to. And that by default uses the current directory, I believe.

You can just go ahead and commit that. And I don't know why we have architecture here. I think it defaults to x64. Doesn't it have all? Yes, you don't need that. And then something else you don't need is this pipe is used in YAML to do a multi line thing.

And since we only have one line here, we don't need that either. But your screen has so much vertical space now. But it's split in half, so it doesn't really. So I still have reason to complain about vertical space. Besides which, that's an important part of my personality. So that worked.

That's good. And so after it updates, then the GitHub pages bot will actually put that up on our website. Okay. Great. So this, this is called a raw cell, which is executed for us, and you can create a raw cell by pressing during this menu. And things that are between three dashes are called YAML front matter.

YAML is yet another markup language. And basically, this is much of key value things in YAML. And yeah, this is where we basically put the information we want. The title is actually not needed because it will pick it up automatically from an h1, or to put it another way, the h1 is needed because it will come automatically from the title.

Great. Nice position, put my name here since I'm writing it at the moment. All right. Something I find really helpful is I use this thing called collapsible headings. And so I just take control shift left and which as you can see it closes everything up. And then you can basically press right arrow to jump to the end of a section or to open a section so that's left, right.

And if you're already at the start of the section you press left again it'll close it up. I find it really helpful for zipping around quickly. As you can see. All right, so we started talking about precedence yesterday. Yeah, I don't think there's too much more to say about precedence.

There's a section called like expressions of which part of that is about precedence and then the other thing we put in here is about functions. Okay, so in Python, or indeed in math, in math you would write a function like this you'd say f of x is, you know, whatever.

Or in Python you would say define a function which takes x and it returns two times x. Or you could create a lambda in function f is a function which takes x and returns to x. So these are all ways you can define functions in math or these two are two ways you can define functions in Python.

They all have something in common, which is that you're telling you're telling the reader in the case of math and the interpreter in the case of Python. What's the name of the thing that you're passing in, and you could pass in more than one thing. Right. Apl is different.

Apl has decided for you what names you're going to call things. So to create a function in apl, it's just assigning something to a symbol. Right. So rather than saying, oh, I'm going to turn my apl thingy on. Which means I just turn on my bookmark bar, which I thought I need a shortcut key to that I don't shift command me.

Let's try that again. Command shift. All right. So we can assign a scalar or a list or the result of an expression with possibly various other functions in. Right. Whatever. Or we can assign a function and to create a function in apl, you use curly brackets. So curly brackets means this is a function.

And then inside the function, you say what you want to do and you don't have to name the parameters. They already have names. If you have one parameter, it's going to get called Omega, which is W. So here's a times two function. And to pass the one parameter. You just check it on the right.

OK. What if you want to create a function called G, which does something times two plus something else? Then a second parameter will always be called Alpha. Now, the second parameter goes on the left. So this will be this becomes Omega. So it'll be four times two, eight plus three is eleven.

That's not right. Oh, sorry. It's going to be this. This happens first. Yeah. Yeah. Thank you. So it'll be two plus three is five times four is twenty. OK. Great. As you can see, I'm still not thinking apl yet. That's, I think, all there is to know about functions at this stage until we get to operators.

Actually. We should do operators first. Maybe. Do we know that's not. I think that's enough. So. What happened? We had more than two variable. Good luck. You don't. You can have zero. One or two. I guess, like, basically, I have a feeling it can do unpacking. It can you can do some pattern matching.

Yeah. So you could pass the list and then unpack it. Or destructuring, as I think some people call it. I guess we should keep that here because that's actually quite interesting. Can you pass in the function above as into the equation function. Can you pass the function about what you mean?

Can you put the F inside the G function? Oh, yeah, absolutely. F and G are now like just the same as plus minus whatever. They're just apl functions that you can do whatever with. So, yeah, so we could H is equal to two plus F of omega. So that's something that I like, right?

Because all the apl glyphs, at least the ones that are functions, are either unary, monadic, or binary, dyadic. And they always, you know, if they're monadic, the thing goes on the right. And if they're dyadic, then they're infix. And the functions you create are exactly the same. And you can create uni-code function names if you want to.

So you can create your own very apl-ish looking functions if you wish. Okay. So when we use the word array, we're using it to mean the same thing that numpy calls arrays and that PyTorch calls tensors. So they're, you know, n-dimensional, regularly shaped bunches of things. And in PyTorch, we call the rank of a tensor, the number of dimensions that it has.

So a vector would be one-dimensional. The matrix would be two-dimensional. A scalar would be zero-dimensional. So it'd be helpful to know how to create things. So we know how to create scalars. You just type 'men'. We know how to create vectors. So rank one arrays, you type them with spaces.

So something's got to be helpful explaining this. Well, actually, first of all, be to learn about iota. You can also, as an earlier step, if you wanted to teach the row, you can actually use the row to reshape and give it a one or a zero to broadcast it.

Yeah. Yeah, absolutely. Okay. Yeah, let's do it that way. Thanks. Oh, we can just type it in. Let's just type it in. So let's just create something. And let's use our trick now that we've learned it. Okay, so display a list we assigned to A. And we're going to have to do this backwards, but I think that's fine.

Diatic first. So let's look it up. And we are going to get to learn a song today. That's the good news. In fact, we're starting to see some of the song here. That's cool. I guess we should mention strings, actually, because they do use them in the documentation a lot.

I don't know what they call numbers and strings and arrays. What's the term for those things, things that aren't functions. I'm going to call them basic objects for now, but if anybody learns what they're actually meant to be called, let me know. In the box, they say it's a language element.

Is it supposed to call all these symbols as elements? Yeah, that's right. But I'm trying to talk about things that aren't those. I'm trying to talk about numbers, arrays, and strings, which is none of these things. We'll figure it out. So strings. I'm not sure there's much more to say about strings.

What does the language reference say if I search for string? I'm not quite sure what order they think they're showing this in, but it's definitely not the most helpful one. I see. They don't call them strings. Maybe this is considered a list of characters. I suspect it is, actually.

I found another blog post that calls them character vectors and scalars. Oh, right, because I think this is different, right? So we're about to get slightly ahead of ourselves, but this tells us the shape. OK, so that's weird, right? So I don't think we should do strings yet until we do row, because they don't make sense until we can look at shapes.

OK, all right, so we've got a list. So we can turn that into a matrix using dyadic row, which is called reshape. OK, this is just called row. Let's see what I did with my heading levels here. So that's two. Oh, yeah, that's three. OK, that's four. Great. So that's reshape.

And so that is, I think it's the same as what NumPy calls it, reshape. Yes, same as NumPy, reshape. So the shape of an array is basically like how many columns and rows and whatever does it have. So if we want to do three rows of two columns, we can reshape our array, as you see.

One thing that threw me off, OK. I was just going to say at this point, like, or maybe at the very top of this, we should say, boxing style equals max. Did I do that? I'll start boxing on style equals max. Your style dash max, I think. Dash style equals max.

Yeah, actually, I can see it in the background there. OK, great. So. There we go. Slow. OK. So I think Isaac wrote something on the forum about this. So anywhere you see an arrow, that means this is like a dimension that exists. Right. There's no arrow here. So this is considered like infinitely thin.

So think of this as a vector, not as a one height. It was a matrix with one row. This is a vector. I was talking to my daughter about this yesterday and she found this very confusing. She's like, well, it does have height. So say like, OK, it does on the screen, but this is a representation on the screen of an abstract mathematical object that doesn't have height.

And it's just that if I drew it infinitely thin, you know, it's like, Claire, you wouldn't be able to read it and you would think that wasn't very helpful, which she agreed was true. Or else this thing here has two arrows. This actually has three rows and two columns.

And then the sprinkle means that it's got numbers in. There's two other options. It could have a mixture of things with some strings and stuff in, or it could even have other arrays in. They would get different symbols. So I think perhaps one of the more interesting ones to look at is what happens if we have one row with six.

And so now it does not look the same, right? No arrow. Arrow. So this is a matrix. So the shape. Is whatever is on whatever you would put on the left hand side to create that thing. I assume it's going to be called shape, but I suppose I should check.

Shape of. OK, shape of. So, for example. Let's call this. Matrix. OK, and so if we then get. The shape of a. It's. A single dimension of length six. Or else the shape of match matrix. Is two rows by three columns. Yes, the question. Yeah, I may have missed this.

What is the writing to the box thing do again? It's just printing it in a more nice way for us. So what I mean is I'll write it to the box that prints it out on the screen. No, it doesn't. If I remove it. Because I'm assigning. It doesn't display it.

Oh, because you're assigning. OK. So you just kind of adding chaining the assignment to sign it to the screen as well. And this box is open auction like. Yeah, that that's a but that's a function called quad. Which I think does a lot of things. I think this is squad is the same name squad.

Nevermind. It's a good question. I don't know. I didn't think so. No squad is used for indexing. OK, so maybe quad is like not a language element and it's some weird special thing. What if I search for it. Yeah, it's a variable which communicates between the user's terminal and APL depends on whether it's been assigned a reference but it's assigned the array is displayed.

OK, so it's a special magic variable. So these are something on these creating and reshaping matrices that cause some fusion for me, but I didn't realize I had a bug. You can actually reshape to any size. So if you have four numbers and you reshape it to a three by three, it'll just look through it'll use the first your four numbers plus the first two in the array to make sex.

And then you'll just do it in your podcast and kind of weird ways. I'm sorry I just wondering, did we, we've got something here called functions and assignment but I don't actually see if we ever did normal assignment. Because I don't think we did. Oh, okay well that'd be the right place to talk about quad.

That seems like a bit of an oversight. So let's pop it. So actually, I guess we can do a function, an anonymous function without assignment. So that's a function and therefore we can apply it to something. And that's the same as first assigning it to F and then calling F on the thing.

Okay, assignments. Okay, so we can go a equals three. A. And then this is the same thing. But with printing. And we can assign a list. Let's see if the box still own the value three. I guess I could check here. It said that there was some special thing when you reference it.

So, no, it doesn't. It's not a normal variable it's a weird special thing. When you reference it a price displayed and input is requested. There's things after it as well like IO and stuff to change the way things work. All right. So that means we can do. We've got a row of our matrix.

We've got a row of A. We could do also things like row of three. And this is special. This is a scalar. I believe. Although it's printing out. Well, this is a scalar. Oh, no, this is not a scalar. This is just this is like the empty set. This is nothing at all.

Which I think there's a symbol for. It might not count as a as one of the last three. I think they called zill today. Just one moment. Yeah, sorry said again. That it's one of the last three zill day, or something, the old day. It's a numeric constant. Okay.

Let's see if that displays the same way. It is. Okay. And the shape of that is zero, I think. How do you enter that. To check the shape. How do you how do you type his order. I just pasted it. It's the back take the right curly brackets. Okay, how did you find that as a matter of interest.

It's kind of far right of your keyboard up at the top. Three from the right. Oh, well found. I see empty numeric vector. Great. So interestingly the rank of zero day is not zero day. It's actually an array containing zero. So this brings us to the song, which is that if I so given that row of Matt is two three.

That means row of row of Matt is two right because it's like this is a list of one dimensional array rank one array containing two elements. So this is row of two three. So row of that is one and because row of zero day is this row of row of that.

Is one and row of row of row of that is one. And actually let's go higher dimensional. We can do bigger ones. We can say give me two faces each with two rows each with three columns. This is like a kind of a rectangular prism if you like. And that's how they display it changed along the lines.

Just run this again. And you'll see it's created two matrices that kind of you can think of them as stacked on top of each other. So this is the rank three tensor. It's when it ran out of numbers from a it just went back to the start. So you can use row as repeat.

So for example if I use a scalar is just a matrix of ones. So let's call this C for cube. And so we can get this on that matrix thing. Does the thing on the margin of it mean anything to you like this one here. No no like the one above it you know this one here.

Yeah yeah this has got this has got two. There's actually two dimensions happening here. There's this dimension and there's this dimension. So ideally if we had a 3D display they would be on top of each other. But we don't. So just print some with a space between and it puts two kind of dimension lines here to tell us.

This is actually representing two separate axes because this is two faces by two rows by three columns. I see. OK so each arrow is kind of a dimension in exactly exactly. Yeah so we could do row of row of row of C and so row of row of row of anything ends up being one.

And so that gives us our first and possibly only APL song. APL row row Richard Storman. There we go. Oh there is actually a dialogue poetry section that's important. And here's the one about row which Claire and I have now learned by heart row row row of X always equals one row is dimension row row rank APL is fun.

So yeah row row row of anything gives us one row of something is the dimension. So row so tells us how many rows by columns or whatever it's I would call it a shape dimension row of row of something. So row of row of something tells you the tensor rank.

So that's why that poem. One above it's pretty good too. There you go. There's an MP3 recording of an APL song. So to wrap up let's do Iota which is a nice easy one. So Iota is just the same as range basically. Iota four it's the same as range except it starts at one rather than zero by default.

You can change that. I believe you can say quad IO zero or something like that to change like so it starts at zero instead of one. I kind of like just going to leave it in the default otherwise it's just going to get confusing. If you haven't found it yet one of the really cool things about Iota is you can range in multiple dimensions.

So if you do Iota to two. Yeah so it's creating basically all of the coordinates to kind of index into a multidimensional structure I guess. So here's it's so this is like the Cartesian product of the set of one two with a set one two three. And so now we've got arrays and arrays and so you can change the symbols changed.

So to create our matrix an easier way to create the matrix would have been to just go two three row of Iota six. So Iota six is one two three four five six and then two three of that is the matrix. All right. So let's close it. I had a question.

With Iota like you know how like in Python we have like a start stop and step. Is there something similar with Iota. No, it's not. But you don't really need it right because like let's say I want to step by two. That's easy enough, you know, or if I want to start one more than that.

That's easy enough, you know. So I think that's why we don't really need it. Okay. Okay. Where is it? Here it is. Okay. Monadic Iota means index generator. Okay, so that's why it's called index generator because these are the indices of all of the locations in a two by three array.

Index generator. Okay. And then dyadic. Okay, let's just check the help for index generators to see if we missed anything. Okay, so R equals Iota y, you pass it a scalar or a vector of non-negative numbers and you get back in the America Ray, the set of all possible coordinates, which is exactly what we thought.

Okay. Oh, so that's interesting. So I think one special thing is Iota zero, which is another way of getting that yoga thing. That's the empty set. Okay, so the dyadic version is index of. And this won't make any sense really until we've got strings. So let's do strings first.

Okay, so strings are basically. Vector arrays, sorry, character, character, vector, characters and character vectors. That's a character vector and that's a character. And so now we should be able to understand their example. So I've noticed the examples when I click on like the name of like the dyadic version, for example, the examples tend to be more complicated than the one in the overall summary just to warn you.

So I'm going to use the simpler ones. Okay, so index of takes this list, this array and tells you the index of each of these things. And so remember, this is a list of three letters. I believe it's identical. Let's see. Actually, it's true. Here's ACF and here's a list containing ACNF.

Yeah, they're the same thing. So that's interesting. Yeah, so that is a single character. This is a list of characters, and this is just a little syntactic shortcut for creating a list of characters and lists of characters appear with no space between them when it outputs them, but they are still just lists of characters.

I believe if you put a character on the right hand side that's not in the left like the Z, it will give you one more than the total link. Oh, good. 11 is there but it's not actually in the list. Thanks. So then an interesting example they have is if what what if you've got a higher ranked matrix.

So here they're saying, oh, let's assume I've already got a matrix with this in it, because they're assuming we don't know how to create one, we might get confused. So now that we do, let's go ahead and create one. So I've got a matrix and they used three rows of two columns of iota six.

Okay. And so then they said, given that what if we do this. Now what's that doing. The first occurrence of sub arrays in Y, which match major cells of X. Okay, so this is an important concept. I don't know the difference between a sub array and a major cell yet, but the idea is, okay, so why is the thing on the right X is the thing on the left.

So here's why. So it's going to try to find this. What do they call it this. It's going to try to find this sub array in the major cells of X so this they're going to treat this as a row and trying to find which row contains that in it.

And the answer is row three. It doesn't work if you put 135 or something, but we'll find it, I guess. So that doesn't work. I'm pretty sure it's not going to because that's not considered a major cell. Yeah. So the major cells of this so it's rose so if you wanted to do this you'd have to transpose it first, and there is a transpose operator.

There's. You could probably do like, I think something that's missing in the dialogue docs is the simplest possible versions of things. So let's just say let's find the number three in the list 13654. Now why is, oh, wrong way around. In the list of this, find the number three.

Okay. Are we done. We made good progress. I think so too. Thanks gang. Vectors lists and arrays the same term in APL. No, an array is like a NumPy array so an array can be any shape. So a vector is a rank one array. A matrix is a rank two array.

A scalar is a rank zero array. I don't know what we call rank three arrays but. It's the same as what PyTorch causes tensor. Thank you. Although one difference is a PyTorch tensor can't contain tensors. But I think a NumPy array can contain arrays so it's probably more like NumPy than PyTorch.

All right, thanks everyone. That was cool. We all let something happen. Bye. Thank you. Take care, everybody. See ya.