The challenge of the Yukon It's Yukon King Swiftest and strongest lead dog of the Northwest Placing the trail for Sergeant Preston of the Northwest mounted police in his relentless pursuit of lawbreakers Gold gold discovered in the Yukon a stampede to the Klondike in the wild race for riches Back to the days of the Gold Rush with Sergeant Preston and his wonder dog Yukon King As they meet the challenge of the Yukon Jim Lucky had come to the Yukon territory during the Gold Rush and it brought his wife and ten-year-old son with him They had stake to claim a few miles out of Selkirk on Beaver Ridge and through the summer months Jim had been able to dig enough gold from his claim to make ends meet But when winter came the claims seemed to give out and Jim realized that he and his little family would soon be without food One morning Jim paced the cabin as he talked over the situation with his wife Sally might as well face it Sally Claim isn't paying off and we're almost out of supply. I know Jim Seems useless to try and work the claim anymore The only thing I know of to do is to try to get a job in town Well, if you could it would help see us through the winter And then in the spring maybe we could sell the dog team in the cabin and the claim and so go back to the state Go back. Yes Jim, I didn't know what it would be like up here in the winter. I wouldn't have agreed to come here The cold and all the awful snow and ice. It's almost more than I can stand. I wasn't thinking of going back Sally You'd feel different about it if we were making a goal of things I feel that our big chance for the future for Bobby's future is here in the Yukon The only future I see for us right now is cold and perhaps starvation Don't ask me to stay here Jim. I've made up my mind that we're leaving as soon as we're able to get away But if I find a job in town, maybe by spring we'll have the scarce in Selkirk. You know that as well as I do But I guess it's the only thing left for you to do right now But even if you do get a job take it with the understanding that you'll give it up in the spring And then we'll sell out be a reasonable Sally I do get a job. It'll be with the idea that maybe we can save enough to stake a new claim after the thought comes Why do you have to be so stubborn? I'm sure if you did take another claim We'd wind up facing another long winter in the same condition we're in now Please please Jim. Don't ask me to go through all this again For my sake for Bobby's sake. Now don't get so upset honey. Things are tough enough as it is. Oh, but I can't All right I'll drop the matter for now The important thing is to get money for supplies to see us through But the matter isn't decided Jim when spring comes we'll discuss it again But promise me you won't make any definite decision about another claim without talking it over with me first All right, Sally. I promise Yes, sit down Bobby and I'll fix your bowl of mush. Oh, we had mush for supper last night All we get is that old mush stop complaining son I'm going to town and maybe when I come back. I'll bring some supplies gosh dad That's what you said the other day, but you didn't bring anything back when you came home, huh Bobby? I I'm going to town now Sally This time I'll be sure to bring home something You can count on it Bobby The boys complained it upset Jim considerably and he headed for town with his dog sled Determined to keep his promise to bring home supplies His credit had been stopped at the general store, and he knew it was useless to ask for more But he did have at the store with an idea There's Marlon Jim doing any better with your claim. No Same Mike, how about letting me work for you for the winter I could pay what I owe sorry Jim I've had a half a dozen asked the same thing, but I don't need anybody Why don't you try the cafe they might put you on as an extra weight or something thanks Micah I'll try over there. I'm sure sorry Jim, but you know if I could afford to take yarn I would forget it. I'll find something to do somewhere Well, I wish you luck, but the towns full of drifters hoping to find jobs to see them through the winter Yeah, I know see you again Mike so so long Leaving the store Jim went to the cafe The Approach the cafe owner who was standing near the bar morning, mr. Pryor Not so well right now I I came here to see if you might be willing to give me a job any kind of a job Like he had the fifth one this morning who's come asking for work I have more hands now than I really need but you needn't pay me much Just enough to buy supplies for me and my wife and son Have a couple right now working just for their meals. I'm sorry have a mind then thanks Just as Jim turned away with disappointment and desperation showing on his face two men who would overheard his request Whispered together at a nearby table Then one of them called out. Hey fella. Give me a minute. Will you you call me? Yeah Sit down a minute. We want to talk to you might as well What's on your mind, mr. I'm mark Harvey. This is my friend Van Layton. Hi, my name is Jim like he glad to know you From the way you looked when you were turned down like he you must need work bad I sure do Have a wife and boy to feed back on beaver Ridge were my no good claim. It's maybe and remember. I'm just saying maybe We could throw something your way like he will you you mean you could give me a job Well, what we have to say is confidential. So keep your voice down. Yeah, we have a deal on And if others get wise they might beat us to it. That's right But the job if you can give me work I'll do anything just so I get paid enough to buy supplies.  Maybe we'd be taking a chance. No honest. I don't care What it is and I'll keep quiet about it just so I get the job well Maybe we'll be able to use you at that Come on. Let's go to our room. I'll tell where we can talk in private. All right. I Think we might as well let you have a job as long as you need one so bad Let's go Mark Harvey and Van Laken took Jim to their hotel to discuss the work They offered it after they were seated in the room Jim asked well What is it you have to offer they noticed in the window of the cafe that you got a dog team That'd have to be part of our agreement like ink. Yeah, that's right Then what you really want is to hire my dog sled and have me drive it. Is that it? We want a dog sled all right, but we'll do the drive enough and Yeah, I don't get this you said you had a deal on him might be able to give me a job Now you say you just want to hire the dog team you could hire a team at the livery stable sure But we don't intend to bring it back.  Hey, what's the idea sure got the cords already.   Oh Put them out cold. Yeah I'll try and gag him. I'll wait before your time. I'm gonna change Parker's with him We leave him tied and gagged in the closet here. Yeah, the room's paved to the end of the week They won't clean up to land We lock the door Nobody'll find him for several days Let's get busy the two crooks mark and van tied and gagged Jim Lackey after Mark had taken Jim's pocket away The unconscious man was put in the closet bear He won't come to for a long time when he does he won't be able to attract attention Come on out close the door. All right Now they have a long way before we do what we plan mark We got to get his dogs live without attracting notice to it'll be easy You stay here and wait like it back. Now. Where you going? I'm going to the cafe and get like his dog team Somebody might see you taking it. Look this park our lackeys is all I need Okay, I'll pull the hood forward like this Anyone happens to spot me from the cafe window. They'll think it's like he leaving with a sled. Yeah, that's right Your body size and all But where you gonna keep the dog team and sled do we're ready to use I'll run it behind this shed That's in back of the hotel. The dogs will burn the snow bank. Nobody will notice them In any way folks won't be looking for Jim lackey since they won't know he's disappeared so we're a good distance away from here What do we do after you get back here? Sit around this hotel room for the rest of the afternoon. No reason to we'll both go back to the cafe And when we're ready, we'll do what we planned I'll go get that dog team and sled That evening sergeant Preston who was following the trail to Selkirk stopped the lackey cat Sergeant Preston and King do come in thanks Where's Jim isn't he home? No sergeant. He isn't in it. Well, frankly, I'm worried worried Jim left this morning to try and find a job and I expected him home before this You say you went to find a job. Yes. Yes, the claim is given out entirely. Oh, I'm sorry to hear that That's it. He bring back some supplies. We only had mush to eat yesterday. That's Bobby. Oh, things are that bad Yes. Yes, Sergeant. I I've never seen Jim so discouraged Frankly, I hope we can leave here in the spring for good Jim doesn't want to he finds a good claim things will look different Sally Don't you worry about Jim. I'll look him up since I got to town. Thank you so much. Sergeant.  Will you sergeant? Yes, of course. Bye for now. Bye sergeant. Let's get going Sergeant Preston arrived in Selkirk and after stopping at the constable's office. He searched the town for Jim, but without success Meantime Van Laken and Mark Harvey was wearing Jim's parka moved cautiously behind the general store It had begun to snow and Mark seemed pleased as he spoke in a low voice Everything's working out our way then the snow will cover our tracks. That's a break. All right Well, it's about time for Mike to close. He closes in midnight He comes out the back door then locks it after him before he goes to the cabin And you'll see the dog team there at the corner of the building The light shining from the windows that build next door is just enough so she'd be able to see me and the dog team Think you'll recognize like these dogs.  Mm-hmm when he steps out of the door I'll stick my gun in his back make him go in and open the safe You keep out of sight till I signal you through the window Store elimpus went out He's gonna leave. This is it. I'll wait here alongside the door. You beat it around the corner of the building. All right Hold it you glory be get inside. I go up sure sure the reflection from next door gives light enough Open the safe hurry. You won't get away with this busy. All right.  He say anything sure He said he knew that I was Jim Lackey Come on. Let's get the cash from the safe and we'll take some supplies and head out of town It was some time later when the storekeeper Mike entered the constable's office with a handkerchief tied around his head Sergeant Preston and the constable both looked up in surprise then the sergeant asked what happened Mike Sure, and I was held up and robbed. That's what sit down Mike and tell us about it No, as I remember this is just the way it happened Briefly the storekeeper related what had taken place at the store up to the moment that he'd been struck down The two Mounties listened intently then sergeant Preston spoke evidently it was done by someone who knew your habits Mike Was it light enough for you to get a look at him? It was sergeant and to sad I am to have to say I'm sure he was Jim Lackey Jim Lackey That's hard to believe maybe it is costable, but I got a look at the dog team. He had waiting I recognized Jim's lead dog for one thing and for another I recognized his Parker It had a big patch of black fur at the bottom where it had been mended it could have been Jim All right, didn't you see his face not just as I was shorn above the band down he wore He spoke in a low tone and seemed like he was trying to change his voice but Jim Lackey I can understand why he came looking for a job early in the day Said he needed supplies and didn't have any money. That's right I stopped this cabin on the way here this evening his wife told me they were practically destitute He cleaned out my safe and a lot of supplies are missing from the store Did you tell him you recognized me Mike sure that's when he socked me and knocked me out I'll get my dog team constable. I'll take King try to pick up the trail to back as a snorer I not just got to Jim's place sergeant. It seems to me. That's where he'd head with the supply That's what I think Mike.  That's right.  No, I think it was definitely planned to knock you out So that you could identify him later to the police as Jim Lackey Sure, and that doesn't make sense sergeant I don't believe he'd be foolish enough to leave his team with that distinctive lead dog in full view Nor would he wear that parker with a black patch if he planned to rob someone What are you driving at sergeant Jim didn't hide the fact that he was in need. That's right I heard he was asking for a job all over town Don't you see he'd be perfect as a frame up for someone who wanted to commit robbery and get a team for the getaway You think Jim Lackey might have been framed by someone. That's right Constable the only way to prove my point is to get on the trail of the thief But if he doesn't turn out to be lackey, what do you suppose Jim is? That's what I want to find out I Looked all over town for him, but since King isn't familiar with his sense and I had nothing belonging to Jim They weren't able to find him. I got my dog team ready now and we'll go to the back door of the store Daniel pick up a cent there. Come on King Meantime the two crooks had headed north after traveling about two hours Mark spoke soon reached the deserted shack I told you about Ben and we'll put up for the night.  All right, you wind up breaking rocket prison. I guess you forgot We left him tied and gagged in that hotel closet, huh? Oh Yeah Well, maybe for the time they find him you'll be dead Hey, wait a minute. What's the matter? One thing we didn't think of mark When they find him in our room and the Mounties will start looking for us Forget it. We'll stay in hiding and they won't be able to pick up our trail. Well, there's the shack just ahead. Must you ask you? When the two crooks had gone into the store to get supplies they had stepped in grease drippings behind the counter Sergeant Preston and the Constable took King to the back door of the store and it was this strong greasy scent Augmenting the natural scent of the crooks that King followed. He disregarded the lighter scent. They had left coming from the hotel Preston and the Constable followed as Yukon King led the dog team along the trail left by mark and van Trail Kings following goes in the opposite direction where like these cabins located I'm beginning to think you're right about it being someone else sergeant Jim would have taken supplies to his family I'm afraid he's been murdered. I never thought of that. We'll find out when we catch the man with trailing He has a good start on us. I'm hoping he'll stop to rest somewhere Constable He wouldn't expect to be followed in this falling snow evidently. He never heard about King without King. We'd have been stopped at that Now I see a light up ahead. Must be a cabin there Maybe we'll get some information if we stop there Well stop here and go ahead and investigate that cabin constable looking fire I think King and circle around so we'll come up behind the cabin. All right, let's go come on King Inside the shack mark and van who had slept a few hours were having coffee before hitting the trail again Where's a good place to hide out mark if you thought of warning? Yeah, we'll hide out of the trapper's shack at Pellies Landon Mounties will expect us to hit for white horse or Dawson City They'll be hunting for Jim like it for two three days. That'll give us time to get there That's right. And remember with that fallen snow. We're not leaving the trail Hey, listen the dogs out there. Maybe a bear some other animals snooping around.  Hmm. I don't get it. It's dark outside Anybody snooping could see us through the window. Yeah After you lie down the lights up get on put on your park out put on mine And we'll ease out the front door Even though it's dark It's not too dark for us to sneak around the shack on either side with our guns ready and see if anyone might be there If you do see anyone shoot I get up and go to bunk all right I Still think it's only an animal We know we couldn't be trailed with the snow falling to cover our tracks as fast as we made them You fool even if someone didn't trailers might be a traveler who saw the lighted shack and came here to investigate We can't take a chance of being seen by anyone Now I get your point I'll go lie in the bunk like it told me Well might as well put out the lights so we'd be able to sleep a while Now hurry get into your parking The dogs see us and stop behind the shed right by a king Look lights gone out in a shed. Yes Those must have put him on guard the two Mounties and Yukon King had stopped behind a small shed Preston cautiously looked around a corner of the shed. He could see along one side of the shack from his position But not the other He waited a few moments and then as the dogs quieted He was about to move toward the shack when he saw a figure appear and creep forward alongside the building I see someone He's moving this way. Let's get him. Come on The two Mounties move quickly from behind the shed and as they ran forward Preston called out the name of the crown I'll fix you. Don't try it This gun drop we've got him good shooting sergeant I'll fix your wound as soon as we get you inside. Come on. All right Come on Not knowing that another gunman was on the other side of the shack the two Mounties started toward the front door with their prisoner Mark had heard the sergeant call out and had heard the shot They got back realizing a fan had been wounded Mark retraced his steps to the corner of the shack and waited with ready gun For the two Mounties to come around to the front door with a wounded man The two Mounties started forward after seeing van the great dog King started to follow But the intelligent dog decided there was something wrong He had followed two cents along the trail, but he saw only one man King knew he must find the other one. So he turned and headed around the offside of the shack There he saw the other crook mark where turned back and was moving toward the front after hearing Preston call out to his partner King stalked cautiously behind the unsuspecting crook was watching closely for the Mounties to appear as They came around the front corner of the shack opposite him mark aimed his gun and then King sprang The big dog sudden lunch and set mark crawling and he lay struggling on the ground Okay, don't bother. I'll pick up this gun.  That's Jim Lachey's Yes, and I noticed that dog team outside belongs to Jim tool Bring over that carpet bag. That's under that bunk there constable sure I'll bet the Mike's money and gold is in here. I'll open it This is the golden cash stolen from Mike's safe. All right Mike described it Five pokes of dust and the rest and gold coin and paper money Who are you? What are your names? I'm Van Laken.  He's back in town in a hotel room He's tight and gagged in the closet right so you can't pin a murder rap on it That depends he may have suffocated in that closet with a gag in his mouth.  No, I won't he he planned it like that But after he left I I went back and opened the door part way Sergeant you were right about someone trying to put us off the trail by blaming Jim. Let's hurry constable We'll bind that crooks wound and we'll head for town and let's hope we find Jim like he alive The following morning the two mouties arrived in South Kirk with their prisoners and went directly to the hotel room Go on inside both of you What's in King? We're looking the closet constable. I hope he's alive There he is Jim help me untie him constable Gags loosen now his wrist That does it Seems to be gone sergeant help me get him to the bed Still alive. He's coming to good It's lucky for those two crooks. He didn't die Jim Jim Sergeant press It's all right Jim we caught the crooks. We'll take you home just as soon as we got them behind bars I'll stay here with Jim if you want me to sergeant all right constable. Come on you two You're under arrest in the name of the crown. Let's get going Jim Lackey weakened by the blow on his head and by the ordeal He went through in the closet was taken home and put under a doctor's care Two days later a sergeant Preston with a constable and Mike the storekeeper paid a visit to the lackey cabin They found Jim sitting at the supper table with his wife and boy While Bobby played with King the three men sat down to have coffee Finally sergeant Preston's smile and spoke Jim you went through quite an ordeal in your search for a job But you seem to have fully recovered from your experience. That's right surgeon. I have tomorrow I'm gonna start looking again the supplies you sent out sergeants will see us through for quite a while I wish I was big I'd go find a job too. I bet you you have a few years to wait yet You want so much to help us? You'll be going to school in Selkirk in the spring Bobby Best way to get a good job when you grow up is to learn all you can Bobby will go to school sergeant But I'm reasonably sure it won't be in Selkirk if there's any possible way to get back to the feet Yes, Sally maybe if I do get a good job no good jobs to be had here Jim I'll not let you try to work another claim But if as Jim said he did find a good job Sally what then well Perhaps if it was a lasting job that would give us a good living that's your cue Mike Tell them why you came out with us. Yes Well, you see Jim I got to figuring I'm getting along and can't do things like I used him And I got to talking to the sergeant Well, he showed me where to be smart for me to take on a young fella Who could later on run the business for Jim Mike wants you to work for him permanently Sure, that's it. It is a fine business and you might work into a partnership someday Jim. I'd like to have him What do you say? Gosh, I I don't know what say Jim I think it's wonderful and you'll let Jim accept Sally. Oh, yes, of course golly, then we'll be good Then we'll be able to get all them All we want to eat and that'll give me candy to sometimes won't eat sure that's right, honey Lots of supplies for the family and candy for you whenever your dad decides you've been a good boy Gee will I can I'll be a storekeeper maybe when I grow up Bobby? I thought you said once you wanted to be a money like Sergeant Preston gosh You have plenty of time to make a decision about that Bobby Anyway, you'd have to be a British citizen to become a money. Well, then I'll learn to be a storekeeper like I Seems to be settled thanks to you sergeant and to Mike I'll get a job far better than I hoped for well now that the two crooks are in jail and a job for Jim has been arranged This case is closed In our next adventure Two men are lurking in the darkness outside mounted police headquarters. Well, it happened sergeant Preston has found Gonzalez He and his wife are inside headquarters right now good We'll wait here till they come out and then fail them that sure was a smart plan you figured out We couldn't locate Gonzalez ourselves, so we tricked them out. He's into finding him for us. Yeah now that he's been found We won't let him out of our sight till he leads us to those rubies and we'll kill him and his wife and grab the rubies for ourselves Lee in a lane Gonzalez are in terrible danger Sergeant Preston doesn't realize that fact and by the time he finds out the truth It may be too late to save them and himself from death at the hands of two ruthless killers Be sure to hear this next exciting adventure tomorrow These radio dramas a feature of the challenge of the Yukon Incorporated are created by George W. Trendle Produced by Trendle Campbell Enterprises Directed by Fred flower day and edited by Fran striker the part of sergeant Preston is played by Paul Sutton This is Jay Michael wishing you goodbye and good luck until our next adventure This is the mutual broadcasting system


I'm surprisingly nervous today. Gambarimas. For Samarata, I didn't make this esoteric language, I'm just implementing it, and you can see the JRuby, what do you call it, logo, logo, or mask head of Keynote, but it's not a JRuby talk. It's about an esoteric programming language. I do not look like this, but it is my avatar. I co-lead the JRuby project, I work at Red Hat, I obviously know Ruby, I'm a crap beer drinker, so if anyone knows a good brewery in the Austin area, I'll be here till Sunday morning, let me know. I'm sure there's a lot of opinions I can already tell. I know I don't. So what's an esoteric language? If we look at Wikipedia, it has a lot to say, and it's very, very squishy. I'll just boil it down to one sentence. It's a language which is intended to be hard to understand or read. The most famous one is Perl. I use Perl for 10 years, I do like the language, so I'm allowed to make this joke. But I wanted to make an additional point. If you've never seen Perl before, you can figure out that this prints something out five times. If you look at this, this is creating a space for an object, it's an O thing. If you know Perl, it's totally natural, it doesn't look strange at all. You start looking at some of the Perl six features, then you start losing some of the Perl programmers. But I just wanted to qualify that something seems esoteric if you have no experience with it. So it's my, the philosophical part of this talk is done now. But something to think about. So I'm gonna talk about Paiet for the rest of this talk. It's named after Paiet Mondren. He's responsible for the artwork on the right. God, he looks so much cooler when he's younger. Like I don't know how you get here. But when he was young, he was like somewhere between Clinton and Time Traveling Hipster. But I don't know, when you get old, you just like make bad choices. Anyways, I'm gonna talk about the language Paiet. It's image-based, just like Smalltalk. Well, actually not like Smalltalk. Your source code is literally an image. This is a PNG image. If you go and execute this program, it prints Paiet to standard out. It's also known as a fung language. So it works with coordinate systems. That makes sense since the program is an image. It's stack-based. Actually, most of the esoteric languages are based on stacks and being very primitive machines. It's based on codles. Codles are just an n by n pixel square. So codles make up groups. So in the upper left-hand corner, we have a three-by-three group that's size nine. Next to it's the dark blue group and it's eight because green's taking a little chunk out of it. There's some runtime state called a direction pointer. It initially points right. It moves around in the clockwise way and it can change in other ways. There's a codle chooser, which is either left or right. And execution of Paiet is moving from one group to the next group. And it's based on this navigation rule. You follow the direction pointer to the furthest extreme of the group. And then depending on whether the codle chooser's left or right, you go to the left or right most at that extreme. Oftentimes, that's the same codle. So just to solidify this, when we start the program, we enter this normal blue group. The direction pointer is right. Codle chooser's left, so we enter at the top. But if the codle chooser would have been right, then we just enter at the bottom. Pretty simple. Let's just go for a slightly more tricky example. In this group, if the direction pointer's right and the codle chooser's left, they go all the way to the right and we pick the top one and we'd go across there. And obviously, if it's right, we'd go there. All right, so simple language, right? But it gets easier. So there's six colors and each color has three different shades. When you move from one group to the next group, you look up in this table what operation you should perform. So we got stack-based operations, math, comparators, input and output. And then pointer and switch, which just take the top value and spin those values around. These three transitions of blue show you going one lightness darker and this would be a push. You'll notice that it's just a cycle. So the darkest value, getting to the lightest value is one darker. Here's two hue changes difference. This is a divide operation. Again, you just follow the circle around. So now let's step through the program a little bit. We enter from the upper left-hand side and we're in normal blue and we need to transition to dark blue. I explained all that work earlier. So we go and look up in the table. It's one darker, so we're gonna go and push a value. And what we end up pushing is nine because that was the size of the normal blue group. So this is the only value of group size. It's only for push.  So black is the equivalent of going off the image or you just can't pass through it. When you encounter either of those conditions, you use this algorithm where you toggle between the codal chooser and the direction pointer up to eight times. If you find a valid place to go, you continue executing. If you can't find a place in eight tries, the program terminates. This is how you normally terminate a PIP program. So going back to step two, the codal chooser shoots us from left to right and we drop down to the bottom and navigate on hot air. So white is a no op. You slide right through it. In fact, you can put other colors that it can't recognize and it's considered to be white. I think I need to take a break. Too soon? Okay, I'll do anything for humor. So I made an arpied. It's a gem. I just realized this morning that I hadn't actually re-released it since I did all this work. So I'll try to do that afterwards. Here's an example program, kaosei.  This is pretty cool. When you execute this program, what happens is you get a prompt and you can type something in and the cow repeats it in full ASCII glory. But this is truly like mind-bending for me.  I have no idea. I wrote a simple program and I find this impossible. Another one that's really cool. You can pass in what total size you wanna use. So if you pass a two by two total in, it prints a pie, but if you pass in one, it prints hello world. So that's pretty weird. This is a conceptually cool one. If you go into the upper left, always certain upper left hand corner, the first thing that you push is something that's half the image in height, which is the radius. And then a little bit later on, you put this jaggy circle as the area and then you do the area divided by r squared to calculate a really bad value of pi. If you kept making the image larger and larger and larger, it would get better, but never be perfect. Okay. So the talk is actually about implementing rpiat. So what I did is I ported Python to Ruby. I'm kidding. The talk's not over, but I did port Python to Ruby. As it turns out, I'm not so good at porting. I don't know Python particularly well and I made some errors. The file I started with was literally a single.py file. So what do you do when you first make a program that doesn't work? You start debugging it. It turns out all the piet interpreters all have a very similar debugging output. And this was useful. I started to make some of the example programs run, but then I decided to take a little step further and I made a graphical debugger.  Oh my God. I'm not here. Does anyone see my, oh no. Oh, there we go, there we go. All right. This is going great. So this is the program I wrote, which counts down from a million, or it counts down from whatever I enter. Here I entered. And now you can see I'm doing a NIN, which is a numeric input. And I'm just adding three to it or echoing it. And so you can step through and you can look at the stack. Look, you can restart. I actually cat a file of three so I could do this. So this is nice. You can set a breakpoint. And now you can see that the stack went from three down to two. And you can see that it was pushing some values because it had to subtract a value. Now it's essentially out of conditional. It's at the pointer command. And I probably should have pushed two instead of three on because you'll have to do this a couple of times. But it'll give you some time to look at the stack. So now zero is on there. And when we resume, we go into this dead end thing and you can see it trying the eight different ways.  So after I got some stuff working, I decided I should start writing some tests. I had to go and make an ASCII image format, which made things a lot simpler than going into the Gimp or something. And then I ended up having to make an image generator application. Oh, I should point out two things. That debugger uses JRuby and it uses a library called JRuby FX based on Java FX. And it's really, really slick. And this particular image gen application was written with another library for JRuby called image booted. So it's not the last mention of JRuby, but use JRuby. So once you generate an image, then you can go and run it against other implementations and make sure it's running the same way. When I went to go and write the program that I showed you in the graphical debugger, I started just writing an ASCII image format of that. And then I realized like, after I was working on it five minutes, that I wanted to add a second dupe in the middle. And then I realized that every color after that second dupe is completely gonna change. So then I had to go and write a tool that allowed me to go and regenerate all these color sequences. It's only one dimensional, but it was pretty helpful. And I can, of course, chain these things together to generate images or just pipe it to iPod itself. So I started with the Python implementation and I was pretty unhappy with it. I don't expect you to read this code, but it's what I call code-chouter. It mixes a whole bunch of stuff together. There's multiple loops, nested conditionals. And pretty much every Python implementation has the same code just in a different language. And so there's really two problems. One, I can't make it any faster. All that out of bounds checks where I go up to eight times is constantly being done. I can't do any more advanced optimizations. And really this is because we're mixing two concerns. The parsing and execution are mixed together. So let's fix it. Does anyone remember McDLTs? So normally when you go and process a language and parse it, you'll generate an abstract syntax tree. So you'll have a Y loop and the syntax for the test will be one child and the syntax for the body will be another. But what does that look like with Pyat? It's two-dimensional so you can have these natural cycles. Well, based on that, let's create an abstract syntax graph because we wanna reflect the syntax. Every operation we perform, like Corsche or add, will become a node in that graph. And we'll add a couple of other nodes for the codal chooser and the direction pointer. So whenever we hit the edge of the image or the black, we'll just push a node saying we need to change that because this runtime state needs to continue to exist. And here's one of the hardest slides of the morning. I'm gonna go and use the original implementation as the parser and it's gonna trace execution. So every time I go and add a node to let's say do a push, the next place it's gonna go, I put that onto a work list, but if it's the switch or pointer instructions, there's either two or four different directions I can go. I push those two directions or four directions onto the work list. Then I just pop off each item and keep processing the work list until it's empty and then keep a visitor list to make sure I don't visit the same place twice. So when I'm done with the parser, I have a nice graph and all this code on the left basically becomes this line on the right in execution. It's much, much simpler now. But actually look at the performance of counting down from a million. It got about seven times faster. So there was a lot of invariance happening. But let's not stop there. Let's try to make it even faster. So I'm gonna convert the abstract syntax graph into a set of virtual machine instructions and it'll be something that a compiler backend can like munch on and make something fast. But we have to get rid of these cycles because these cycles are an unnatural thing for a compiler backend. So all the cycles will be replaced with either jumps or branches and the rest of the operations will map to a series of more fine grained virtual machine instructions. So I'll try to give you an example. This is another hard slide. And the very first at the top is the not operations implementation with the graph interpreter. What it does is it pops a value off the stack, compares it against zero and then either pushes one or zero onto the stack. So this first line just becomes a pop instruction. So this is sort of a one-to-one mapping and it saves the pop value into a variable. And then all the rest is this line. So I don't know how many people have had assembly but we'll just leave it at, this is just a very simple if-else statement. So we check to see if the variable we popped is equal to zero and if it's not equal to that we jump to false, otherwise we fall through the true. But by the time we go and process this graph what we end up having is a single contiguous list of these simple instructions. And for those places where you need to jump or branch they'll record what label they wanna go to in this instruction list and then those labels will exist exactly and they'll want somewhere else in the instruction list. Here's the complete interpreter for executing these instructions. You start at the top of the instruction list, you retrieve the instruction, you execute it. If it happens to be a branch then its result is gonna be a label that it wants to go to. So then it looks up in a jump table saying hey what index in the instruction list is that label at and then it just changes the program counter to that. Otherwise it just increments and continues executing instructions. So if we go and look at how fast that is you'll see that it's slowed down. This makes sense, I mean we actually are implementing a virtual machine now, we have this program counter we have to go and look up jumps so we're adding some extra work here. But we're trying to do this because we wanna compile it. So now we have to come up with a back end. Now things are gonna get weird. So I work on JRuby and I'm really familiar with one internal instruction set which is our own. JRuby when we parse a Ruby code we generate a set of virtual machine instructions that represent Ruby semantics. And I thought oh this is cool. I'll take the virtual machine instructions I made for PYID, I think I keep saying P it, don't I? I can't break that habit. The virtual machine instructions for PYID, I'll just do one transformation and convert them to equivalent Ruby virtual machine instructions. And then I'll wrap that in a lambda. Am I blowing anyone's mind? So now within JRuby you can do a P at require, load your image and when it returns there's a lambda that you can then execute. So now JRuby can run PYID and Ruby. So if we look at the results there's two new numbers here. The first one is running JRuby in interpreted mode. You'll see that it's about 17 times faster than us running the PYID instructions through its interpreter and that's just because we're doing this in Java now. And we're doing some additional optimizations because JRuby is able to do some extra stuff to make things faster. If I actually JIT compile it, it ends up being five times faster again and that's because after we make it into our IR instructions we compile that's Java byte code and the JVM churns on that and generates native code and optimizes it more. So what I was able to get for this talk was a 305 times speedup. A couple other things. I really wanted to target this against LLVM counting down from a million to zero and not using the value. Most compilers are smart enough to realize that you're performing no work and it would have just returned zero and it would have been infinitely faster. And I thought that would have been a much more entertaining result but I ran out of time. I also thought it would have been really interesting to talk about some of the optimizations that JRuby did but the 25 minute talk. I already put way too much material in here as we all know now. So I think it's really fun studying different languages. So most people go and study other languages because they're useful, you might get a job with it but esoteric languages like they stretch your mind in a different way. Using a language where there's two dimensional flow that's just like truly weird and it's fun. So check out some of the esoteric languages. Hopefully this talk demonstrated even if you didn't follow everything that you can take something that's rather chowdery and convert it into something that's a lot simpler and ends up performing a lot better. You can always just keep transforming your problem into something that's much more workable. And never ever submit a talk proposal for work that you haven't done yet. I did have a lot of fun doing it but it was a lot more work than I thought it would be. Thank you.