 As I make this video, I respectfully acknowledge that I am standing on the unceded traditional territory of the Comox First Nation. I thank them for the use of their lands, and I want to express my sorrow for the victims of the residential schools. So this is the final video that I am using for the N words problem. And what the N words problem is, if I have a string, which is a list of words to be used as a target. I would like to select the first four words of that. And to give you an example of a verb that I've already created, there's the first four words. So pretty straightforward. We've come up with a number of different ways of doing it. Some are faster, some are slower, some takes more space, some take less space. But one of the things I really wanted to do was I really wanted to try and find a solution with the conjunction under. And what the conjunction under is, is this one. And what it does is if I put, let's say we do doubling here. And on this side, I am going to do take. And I will do two here. And over here, I'll just give a list of numbers. Okay. So what under does, and what I like to think of it as, it's like the tire changing algorithm. And what I mean by that is when you go to change a tire in a car, you have to jack the car up, then you can change the tire, and then you have to lower the car. So you do an action, you do another action, and then you do the inverse of the first action. Well, here, the action we're going to do first is doubling. And then we're going to take, and then we're going to half. So let's try this out and see what happens. And it's kind of interesting. Now what it did is it doubled each of these, even though they aren't doubled here, they're doubled here. It doubled the two, which is why you've got four, four columns here. If I do four, take any number, oops, I didn't take, I went from, and there's no four index there. Let's do take. So as soon as I do four, take a number, it's going to pad out zeros, which is what's happening here. So the doubling is doubling this list and this number here to four, and then it halves the result. And I can come back with two, three, four, five, and the zeros here. So what would be cool is I actually have a verb called words. If I apply it to S, it will box everything up. So what I was thinking would be really neat is if I could do four, take under words. So and then an S and the S, of course, is my string. So what I would hope to do is this words would box everything up. I would take the first four words and then it would unbox everything. It doesn't work. Why doesn't it work? Well, the reason it doesn't work is if you do words on a number, you get a domain error. So that's what's happening. So I decided that I think the first time in my life, I went to Stack Overflow and asked a question. I often spend time answering questions at Stack Overflow, but this time I said to people, is there any way I can make a tacit verb that will work this way because I don't want to apply the words verb to four because that's causing me a domain error. And Julian Fondren came back with an answer to me. It wasn't exactly the answer I wanted to hear, but he's exactly right. His answer was this. And what this is, is it's an adverb. So essentially, if I don't want to apply this words using under to the four, the way I can get around that is I can create an adverb here that will take the noun to the left of take, attach it to take, and then do everything else I was going to do. And because this essentially becomes a verb, there's no noun to apply words to. And as a result, if I do this, it looks kind of the same and this and it gives me my result. But N7 is actually not a verb. It's an adverb that's taking this and making this whole thing into a verb, which is this and applying it to S. That gives me my answer, but it's not actually a verb. It's an adverb. So having thought that through, I thought, no, I really want to do a verb. This is, I mean, this is what I want to do. I want to find a way to do it with a verb. And there is a way I can only can do it with a verb. And that way is this. And what this verb here is doing is it's essentially doing the whole thing without actually using under. And because I'm not actually using under, I'm not forcing the four to be used as a word. I'm not getting a domain error that way. Because what I'm going to do is when I use this, essentially, I go to the right. I'm going to take that argument. Well, that'll be S. And then I've got a cap here. So look, I've got a fork like here. And so I'm basically taking S and I'm making it into words. Great. Keep on going. And then I'm going to take the left argument and I'm going to take four of those words. So essentially, I get to this point and I go one, two, three, four, perfect. Now here is the verb that I'm going to apply and then the cap on the outside. So this whole result here, which would be four boxed words, now is applied to this. And what this is, really kind of interesting, this bit in the center, the red, is power. And what power is is a conjunction. And it's a conjunction that allows me to apply a verb on this side to its argument. Now you'd say, okay, well, isn't that what you're always doing with the verb? Yeah, it is. And if I just put a one in here, I would just be applying this verb once to it. What becomes neat? There's a lot of things you can do with power. For instance, if you decide to put something that evaluated to a zero or a one, you've actually created an if statement because if you put a zero here, this just goes through with nothing happening. If it's a one, it's going to be evaluated by this verb or evaluated, well, I guess evaluated. It'll be affected by that verb. But a zero in this position would mean this verb is not going to do nothing. You put a negative one and you're going to get the inverse of the verb. So I don't have to find out what the inverse, if the verb has an inverse and I put power and negative one here, I'm creating the inverse. So when you look at this, what I'm doing is the same thing that Unders doing except by breaking it up, I don't have to affect this left argument at all. It's not going to be touched by the words. It's only going to be the only the right argument is going to get the words here. And then once it's selected the boxes, then it's going to be the inverse of words. And that's why it gives me the result I want. So let's just check that. And it's a verb and it gives me what I want. So at least there's a way kind of sort of using under that I can make it work. After Julian had given me his answer with the adverb, Zash came back and showed me something I didn't even know about. In fact, it's only existed since J902. And what that is, is this. If I do this, so I do the same thing, the take and the under. And now what I'm going to do is I'm going to put parentheses. And inside the parentheses, I'm going to do this. And a word, yeah. So what's going on in here? Well, this is called an ace. And essentially it's a boxed empty argument. This is called a tie. And what a tie does with a verb is it'll make it into a gerund. The gerund is like a verb that is made into a noun. So essentially it doesn't do anything, but it describes what a verb would do. So think of cooking. I cook, but cooking is a gerund. It's a thing that is done. It's cooking. It becomes a thing. It's a verb made into a noun. And then of course I would apply it to S and I get my answer. So this is pretty cool. But this actually also opens up like this is where we're going to take it to the next level. We're going to go in and take a look and see what's going on in here, because there's some really neat things that you can do with this approach. So I'm going to declare a couple of verbs. I'm going to make V1. I will make it the take verb. We've been using take. I can use a take. I'm going to make U1 and watch closely here because I'm going to start by making it the double verb. But now using this conjunction, move that cursor out of the way, that conjunction, which is called averse, I can now declare what I want the inverse to be. So kind of weird, but I'm going to have this verb, U1, be doubling unless I want it to do the opposite of doubling, in which case I'm saying make it an increment. Kind of a weird thing to do, but if I do it this way, we start playing around with this. We'll start to see how this whole thing works. It's kind of neat. So it's first I have to finish off that declaration. So there we are. We got V1. We got U1. U1 will double if you apply it to something. But if you want the inverse of it, it's just going to increment. Great. So let's try this. Now, of course, we can't use S because it's just characters and it doesn't make sense to double characters or we want to do, oh, that's a good one, 73. Let's see what that'll do. And I'm going to change this into U1. And of course, we had decided that this was going to be V1. And V1 was the same thing. It was take. So now let's see what happens here. So this is what's going on here. Well, what's happening is U1 is only being applied going in to this list here. It's not touching the four at all. How do I know that? Well, because I'm saying for take and I'm just getting these numbers here. I'm getting four numbers across. So it's taking four. It's not taking eight, it's taking four. But it is doubling these numbers. And then coming back out, it's incrementing them because it gets there. It's actually doubling them. So it would be 10, 12, 146, and four. And that's where you get these numbers almost. But when you increment them coming back out, you add one to them. So you get 11, 13, 147, 5. And where you had those overtakes like up here with the zeros, now you're getting ones. So you can actually have the under work but only apply the verb that you're using onto this side. Can you do it the other way? Yeah, sure you can. Let's do that just for fun. So I'm going to take this. And I'm still going to make it into a gerund using tie. And I'm still going to use ace, which is just a boxed empty list. And this is what happens now. So what's going on there? Well, this means that since the ace is on this side, it's not affecting this at all. So this gets passed in. But U1 does affect the four, which means it's doubling the four, which means I get eight numbers across here, not four numbers. Now, once I've got eight numbers across there, then I'm going to increment them. Well, that's exactly what I did. There's six, seven, 74, three, which is all these incremented. These were zeros before they were incremented because it was an overtake of eight and you end up with ones. So it's pretty powerful. There's two things that are pretty powerful there. One is you can control which arguments are being affected by under. And the other part is you can actually declare using obverse what your inverse of a given noun or verb is. You can make the inverse be whatever you want it to be, which becomes really useful. If you're trying to convert dates and things like that, it can be one way going in and come back another way, which is, that's a pretty cool thing to be able to do. It's a really powerful thing in the language. And it's just one of those things. When you start playing around with some of the functions in J, you can get some pretty neat effects. So, oh, after doing all this and finding this really neat, neat verb, which we'd said, oh, and by the way, the reason it looks like this when I print it back out is because what I'm doing here, this zero, zero is actually the ace. And instead of boxing, I put a tie. And I don't have it as quoted anymore. So essentially what you saw previously with the zero, zero is an actual physical representation of what a verb looks like when it's made into a gerund. Basically, they make it into a character and append an empty list to it and box it. And that's how it's identified as a gerund. But when you're actually writing it, you could write it that way, but when you actually write it, it's a little cleaner to write it as ace, which is the empty box, tie, and then whatever the verb is. And that creates a gerund. So in any case, that is what we've got for an eight. Now the problem is, any works well for the argument that we had before, s. That's great. If I give it s1, which is a list of words that won't be used as a target, there's a problem. And the problem is that s1 has an apostrophe in it. Because it's got an apostrophe in it, the word verb won't work well with it. If I do s1, that's my problem. The word verb doesn't work well with apostrophes. So as neat as it is for breaking everything up and boxing it, and as neat as it would be if you could use under and all the stuff that I learned about affecting one argument and the other, doesn't really matter, because it doesn't do well when it's faced with apostrophes. And that's a restriction that nobody talked about in the actual original spec. So it's not really one that we can get around. On top of that, if you remember time space x, which was a verb that does an action within its string. So let's do 4 and 3s. And we're going to do that 1,000 times. It's going to return the time and the space that it takes. So that's 0.5 or half, a little bit more than half, a microsecond, and just over almost a kilobyte and a half. So that's pretty good. Now, if I do the same thing with N8, which is my nifty new solution, not so good. It's more than twice as big, and it's taking almost twice as much time. And that's with really small strings. So although it's elegant and it's pretty, and I would love to have it work faster, it just doesn't. So it's one of those things you can learn something about the language. And one day, maybe, somebody will write something that makes that particular part of the language a little quicker. But right now, it's just elegant. So if you were trying to show something in a very compact way, you could do it. But at this point, it's not faster. It would be an easier way to explain to somebody, though. Because if you're really just using three things here, you're using your verb that you're applying, even though you're not applying it evenly, you're doing under, you're taking, and then you're reversing under. So conceptually, it's an easy thing to think about, which does make it nice to be able to use. But in this case, well, the big thing is it doesn't deal with apostrophes very well. So I think that's about it. Hopefully, you learned a lot. And that's my last solution for the n words of a string. So I'm done with that. Move on to something else next.