Sort:  
There are 2 pages
Pages

Let's go through every single package installed on a Linux install DVD. Specifically, Slackware 14.2. Of course, these are all open source packages that I'm talking about on this show, so they probably can still apply to you even if you're not running Slackware, and even if you're not running Linux. These are open source packages so you can download the source code and run them on any computer, whether you're running Linux, Mac, Windows, or VSD, doesn't matter. You can learn, probably, something from this episode. So, let's get started. Last we left off, we were doing gperf and gnu-cobol. And at the very end of the previous episode, I predicted that I probably would not get to Guile immediately, because I kind of had anticipated that Guile would be a much bigger deal, or a much bigger obstacle than it ended up being. I'll admit that it is as complex as imagined in terms of coming up with the lineage. That'll be hard to talk about, but the language itself is a lot more like Lisp than (1/55)

I'd realized. Or that is to say, it is Lisp. I guess I didn't quite understand just how familiar Lisp would be for me, and so I wasn't really sure how long it would take me to sort of come to terms with Guile. And I have to admit, it happened a lot faster than I realized. Not to say that I'm by any means an expert in Guile, but I just kind of, the moment I started using it, I realized that this was more familiar than I'd expected. So before we get into that, let's talk a little bit about some listener feedback, because I do have some to go over. One is from Kevin, who says he's very grateful for the mention of AOS in some recent podcast. He's got an interesting interpretation, or an interesting thought about the term spin that I'd never really thought about. So he says, still not entirely liking the idea of AOS as a quote spin unquote, I see spin as a graphical infrastructural change to the same underlying system. For example, Kubuntu versus Ubuntu. It's just headless Ubuntu plus (2/55)

plasma rendering a spin. Now, this is class two for a moment. I'm going to interject that technically it wouldn't equal a spin, it would equal a remix. That's what Ubuntu uses, the terminology for their derivatives, they call them remixes, if I'm not mistaken. Spin, I know, is a fedora term, so I don't know that there's a procedural difference between a remix and a spin, but for what it's worth, I think the terminology technically is different. However, he says, AOS adds in programs I've written to make the system fundamentally different in its use case, targets different user levels, maintains significantly different philosophy, turns off on licensing, focus on ease of use rather than Unix's definition of keep it simple. If that's the same as a spin, you could almost argue that Mac OS X is a spin of FreeBSD, as I have it on good authority, Apple developer friend, that the BSD kernel and its base is still used, but they layer on applications and graphical tools to change the behavior (3/55)

and focus on the BSD base. Not to say that AOS has strayed nearly so far from Slackware, but extremes tend to be the best examples. This is class 2 again. Maybe not the best examples because this is actually factually incorrect. It may have been a paraphrasing of what your Apple developer friend told you, Kevin, but Mac OS X does not use a BSD kernel. It uses a Mach kernel, M-A-C-H, called Darwin, and that is not a BSD kernel. It is not in the BSD tree, it is not maintained by the BSD kernel maintainers, it is a separate kernel, different entity entirely. You cannot, for instance, go to a free BSD repository, I'm sorry, port tree, and download a binary distribution of, let's just say, BSD tar, and untar it on Mac OS, and then run it as is. It's not the same target, it's not the same kernel, that's not correct. But the point is still taken, and the point, I think, is that there's taking a thing and building on top of it, and then there's taking a thing and just changing some settings (4/55)

and releasing it as a new thing. So, I get the point, but I do want to emphasize that Mac OS X does not use a BSD kernel. It uses BSD utilities, so maybe Apple developers who are sort of living in Xcode and using NS libraries and such, maybe they see those BSD utilities and think, oh, it's just free BSD underneath. Well, the utilities are, but I mean, I'm also running BSD utilities on my Slackware Linux machine. I wouldn't claim that Slackware was BSD any more than I would claim that Mac OS X is free BSD. Anyway, the point, as I say, was taken. He also makes another point here. He says, I'd also rather there not be confusion between using AOS and Slackware, essentially. He says more and gives some examples about Arch versus Monjaro, but the idea would be that, yeah, the point of labeling things different, you know, saying this is not Slackware, this is AOS, the point of doing that is that people, is that there's no confusion when you ask someone what Linux are you using, and they say, (5/55)

says here Slackware, then if you start talking to them about init tab settings, then if they were using AOS or Zenwalk or Salix or Porteous, then they're not going to have any, they haven't had that experience because those distributions set init tab for you, whereas sort of a plain vanilla Slackware user would have a lot to say about init tab settings, potentially. So I see the point. I see how the title and the differentiation, that's the term I'm looking for, is significant for like lots of little just pragmatic reasons. Okay, I also got an email here from Hacker Defo, Hacker Defo, and it was quite an exchange, really. We had quite some emails back and forth, so I'm not going to quote all of the emails in total, but I will quote the complimentary parts to the show. They say, and your podcast is completely different from the rest of the pack. The other ones are usually filled with almost the same kind of content, like new hardware products, barely scratching the surface talks, (6/55)

Windows 11, Windows 11, mention of an app or two. Boring in general. You don't get to learn much, if anything. On the other hand, I learned so much about Git Cola from your podcast. I've always wanted to give it a try, but never found a good starting tutorial, and hence never got around to trying it. After listening to your podcast, I'm pretty certain I can start using it without many problems. So thank you very much, Hacker Defo, for that, because I was quite nervous about deviating from the letter of the repository. It says to cover Git, and I chose to cover Git Cola instead. Now, I did refer you, dear listener, to several other Git tutorials that I've done, so I think we're all okay. But this is quite nice to hear, that the Git Cola deviation was kind of actually enjoyable. Hacker Defo also mentions that there's another GUI for Git that is open source, GPL version 2, cross platform, and has screenshots from other OSes besides Mac. And that's on github.com slash soramimi, S-O-R-A-M- (7/55)

I-M-I, slash guitar, spelled normal, G-U-I-T-A-R, guitar. I had not heard of that one, so I am kind of eager to check that out. I will have to check that out at some point. Maybe I'll do an episode on it. Who knows? Hacker Defo, in a separate email, also mentioned that a tutorial on how to install Slackware current might be interesting. And I actually agree. Installing Slackware current and just skipping over 14.2 is a method of installing Slackware. It is not as complex as one might think. It's actually quite easy. The Slackware installer itself is pretty simple. And I'm not saying... I don't mean it makes it simple like two clicks and you're done. In fact, there are no clicks involved. But in terms of just sort of the simplicity of the engine that runs the process, it's pretty simple. And you can point it to a server with Slackware packages on it, and it will happily, as long as it finds the correct files there, quite happily install from that location. So you can just install (8/55)

Slackware current over a network. It's a network install, essentially. Really, actually quite easy. So maybe I'll do a dedicated episode on that and pin that episode near the top of the feed, or the bottom of the feed, wherever I put my long-term episodes. So that's really good feedback. Thank you very much for that. And I believe that's everything. No, actually, there is one more thing. Ken. Ken Fallon, who you may know from Hacker Public Radio, you might know from this show. Ken Fallon says, in a recent episode, you mentioned that the process of filing a bug clears your thoughts. I am finding that filing a bug is essentially pointless. Of the 15 bugs I'm tracking, only two were fixed, and they were duplicates of other bugs. One magically fixed itself, two were still open, one and five years. All the rest were closed as not bugs. My feeling is that if you can't find a bug reported by someone else, it will never be popular enough to fix it. I can identify with this. This is kind of the (9/55)

tough part of filing bugs with open source. I guess the trite answer would be, well, hey, at least you get to file a bug. You know, if you're not using open source and you encounter a problem, your recourse is to get really, really angry and go on to a forum or a microblogging platform of your choice and be very grumpy and vocal about how angry you are that something didn't work. And that's your answer. And you might get an answer from someone telling you how to make it work like a workaround. You might not. Tough to say. But there's sort of, maybe not zero, but almost zero percent chance that a developer of the product is going to follow up with you about the error that you're experiencing, much less fix the underlying issue. So that's the trite answer. The more realistic answer is that it is a little bit of a lottery when you file a bug. You know, whether someone who can fix it is going to see the bug, whether it's something that anyone prioritizes, whether it's actually a bug, (10/55)

whether it's already been fixed in some recent version that you're not running and it's not convenient for you to switch over to that more recent version. Yeah, there's a lottery to it. So I have not had quite the experience that Ken has had, although I think maybe I have, but I'm just interpreting it different. I mean, I do file. I try to file a lot of bugs. I feel like I file a lot of bugs. And yeah, some of them just, they don't get fixed. They don't get the attention that they deserve. I've had definitely Fedora bugs that I've filed, and I think Firefox bugs that I've filed. And I keep getting messages, you know, sometimes a year later, more sometimes, about how the bug hasn't been fixed and the product is end of life and so the bug is going to be rolled over to the next product and it kind of keeps going that way for a while. And then, yet again, sometimes there are bugs that I file that sort of do get fixed but not sort of officially in that bug tracker. So, in other words, it (11/55)

might be something that I have filed. Maybe I get a response about it. Maybe I don't. But then, when I boot up the next version of, say, Fedora or try the next version of, say, Firefox or whatever it is, the problem doesn't exist anymore. And I don't know if that was a direct result of the bug that I filed or whether it's just sort of one of those things that get fixed as part of a larger initiative within the product development. So, yeah, sometimes it can be hard to sort of identify when a bug has been effective and when it has not. Of course, my statement exactly in 409 was that when I file a bug, I often, it forces me to have to go through the process of replicating, of reproducing, that's the word, the bug, and of the error. And many times when I do that, I am inspired to try some other method. I'll think, well, so that I can say, yes, I tried clicking the red button. I better just go ahead and click the red button even though I'm 100% sure that it's not going to make a (12/55)

difference. And then I click the red button and it makes all the difference and no more bug is required. So that's what I meant by that process. Like the process of filing a bug helped me troubleshoot essentially. But yeah, I don't know. I'm going to obstinately just keep saying that filing bugs is good in general because it's just that non, you know, it's just that there's that percentage of a chance of it actually being noticed by someone who can then fix it. But yeah, bug reporters are problematic. You know, they're big, big pools of errors that may or may not be valid and developers have to chip away at that monumental stash of error reports as well as continue to develop the application in whatever direction they want it to go. So I, yeah, I feel Ken's pain, but I'm going to insist that it's still worth filing because that's just a way of giving feedback. And it's a heck of a lot better than just going on to a microblogging platform or a forum and threatening to never use that (13/55)

application again and to question the effectiveness of all the developers and so on. Not that I'm trying to imply that Ken does that. I'm just saying that's, in the old world of non-open source software, that's what I was used to seeing. It's what I still see today within that world. And it's just kind of, it just feels very helpless and I don't like that. And I'm not saying that reporting bugs and having a bunch of open bugs, 15 open bugs that never get solved, that's not very empowering either. But at least it is a thing that you can do that may produce results. And like I say, even though some of those bugs don't get answered themselves, the problems sometimes might get fixed independent of that bug. So, I don't know. I guess I'm trying to say something nice and comforting, but ultimately I guess there isn't something nice and comforting. If you're filing bugs and they're not getting fixed, that is not empowering. It's not fun. But I do think that at least you're doing the good (14/55)

work. You're doing your part. You're reporting the errors as you encounter them. And I think that's admirable and we all think you, Ken, and everyone who files bugs for that diligence. That was nice. Let's go get coffee and then we'll come back and we'll write some code in Guile. GNU Guile. So it turns out that GNU Guile is a dialect of Lisp and more than that it is a... what's the term? It is an implementation of Scheme. Confusingly, GNU also has an implementation of Scheme. So there's some Scheme out there called MIT slash GNU Scheme, which exists, but so does Guile. And, I mean, it's not within the scope of this podcast, or the interest really, to sort of trace the history of half of the things that I'm looking at. I mean, I would be interested in hearing someone do that, but I'm not going to do that here. So apparently, and I'm just kind of taking a lot of this from Wikipedia, apparently what happened was at some point in, like, I don't know, 80s, 90s, something like that, Emacs (15/55)

Lisp existed. And the community started to look at that and think and imagine how it could be made better. And I think the problem probably, I'm assuming, was that Emacs Lisp was a little bit tightly bound to Emacs, and the operating system was a lot bigger. There were other tools out there, other than Emacs, that could benefit from, like, a handy little scriptable Lisp. So some guy named Tom Lord began working on an embeddable language runtime called the GNU Extension Language, or G-E-L, which people realized was in conflict with some other project around the same time. And so it got renamed eventually to Guile, G-U-I-L-E, and I think that has a backronym applied to it, or maybe it was the acronym that someone came up with when suggesting the name, I don't know. But the thing got called Guile, and it was intended as the extension language for sort of the GNU ecosystem. And its advantage was, I guess, that it, well, it's a Lisp, and it is embeddable, so you could write your code in C (16/55)

or something and include a lib Guile, and then you would essentially get an API that your users could interact with through Guile scripting. Which seems pretty appealing, and that's kind of the space, I think, now that a lot of us think that Python fills. I mean, it does. Python fills that niche now a lot. Lua was kind of meant for that, and Lua does serve that niche sometimes in the applications that use it. So you'll find Python scripting and Lua scripting for larger applications. Within the GNU world, the official extension language is Guile. The lineage of all of this is complex, but let's just say that it started back in 1955 with Lisp, the original Lisp, and some history happened. And then in the 70s, something called Scheme came out, and I guess made a big splash, because I still hear about Scheme today. Scheme still perpetuates today, so it's kind of a big deal. In the 80s, at some point, Common Lisp came out, and then Emacs Lisp got developed in like 83, 85, whenever that got (17/55)

developed. And in reaction to that, more or less, we could say GNU Guile was created. That's of course not Lisp's final... The history of Lisp hardly ends there, and that's not a complete history. There's other Lisp's, modern Lisp's, like Racket, and Clojure, and other things like that. So they're out there, still quite useful, being used in real applications, in real life, so it's not a bad thing to kind of get familiar with, possibly. I mean, if that's something that you're interested in, I think that there's a pretty good case for demonstrating that Lisp is a relevant language still today. Okay, so I've already done an episode about Lisp. That's significant, I guess. And I believe that was episode 3... no, 4, it must have been 400 something. Let's look. C Lisp is what it was, and it was 405, that's what it was. And in that episode, we ended up doing a dice rolling application. So I'm gonna just kind of... I'm gonna re-implement the dice roller application in Guile, instead of Common (18/55)

Lisp, and that's kind of as far as I'll go. Like, that's all I'm going to do, is just cover essentially what I've already covered of Lisp, but for Guile. And even in that sense, I'm going to kind of assume that you've heard episode 405. So if you've not heard episode 405 and gotten your introduction to Common Lisp, then before listening to this part on Guile, it would behoove you to listen to the Common Lisp one. I will try to do a very brief kind of reiteration of what I did cover, just so that there's not a hard dependency on 405. But there's a dependency on 405, is what I'm trying to say. So, Common Lisp, you might recall, has an interactive programming environment that you could invoke with the command C Lisp, and then you're dumped into this sort of Lisp prompt. And you can do things. You can do programming things in Lisp. Just like the Python idle interface, if you've ever used that. Guile also has such a thing. I don't love it, but it's a thing that you have available to you. (19/55)

So, Guile, you just type it in and then hit return. So, G-U-I-L-E, return. And you get dumped into a little prompt labeled SchemeAt parentheses Guile user, close parentheses, angle bracket. That's your prompt. You'll see that a lot. And you can do things with Lisp. Now, if you'll recall, Lisp is a Lisp-centric language. That everything in Lisp is a list. And the syntax is a little bit wonky. Or, not wonky. It's just not necessarily what you would expect. So, the idea is that the first element of a list is the magical keyword that you want to do, like the function that you want to perform. And then the other parts of the list are arguments toward that function. You can embed lists in lists so you can have rather long statements, which kind of, you know, you fall into another set of parentheses and there's a whole new list there. But that's fine. That's actually pretty normal. So, a really basic statement then would be parentheses plus sign space one space two parentheses. So that's a (20/55)

list of three characters. There's a plus sign, there's a one and a two. The function that we're invoking is this plus function, this addition function. And the arguments that we're passing to the addition function are one and two. You can probably guess what the result is going to be. It says dollar sign one equals three. And that is correct. The product of one and two is indeed three. And that's the first thing that we've done in Lisp, and so we get a little dollar sign one to denote that. We could also do something like parentheses plus space parentheses minus space five space four parentheses. Parentheses, let's do another plus, one space three, close parentheses, close parentheses. So I've got parentheses plus, and then the arguments that I'm handing over to the plus are both lists. One list is minus five, four, and the other list is plus one and three, and then I close the wider parentheses. If I do that, it tells me that the result is five, which sounds about right. Five minus (21/55)

four is one. Three plus one is four. Adding one and four together is five, so yeah, I'd say that was correct. One of the annoying things about the Guile interface, the interactive interface, is that the up arrows or control P, it just doesn't seem to be valid. It doesn't work, so that's kind of annoying. I don't know how to get previous commands. I don't know how to rotate up, so you just have to retype everything. When I discovered that that was the case, I kind of stopped using the interactive interface, which is what I'm going to do right now. So I'm going to hit control D, which by the way, they don't tell you how to get out of the prompt, so it's kind of nice to discover that control D works. I didn't actually know that until way too long. I kept hitting control C, and it would spit angry errors back out at me. Control D delta gets you out of that interactive mode, and frankly, it's so annoying that you should just stay out of the interactive mode. Okay, so let's see. A couple of (22/55)

things. This is not Common Lisp, so some of the things that you're maybe used to from Common Lisp or even Emacs Lisp just don't apply here. And that was the biggest stumbling block for me, is that it felt so familiar, but all the functions were different. So the syntax is the same, but the vocabulary is completely different. Well, yeah, completely different, pretty much. I mean, I'm sure you'll likely find overlap here and there, but just tell yourself the vocabulary is completely different, or else you will be setting yourself up for disappointment. Alright, so to write a Guile script, which is what we'll do since I'm trying to avoid the interactive mode at all costs, I'm going to do emacs-hello.scm. That is, as I've discovered, not because of the documentation by any means, but because of searching online and kind of getting the feel for what the community favors. SCM, which I'm imagining stands for Scheme, is apparently the preferred file extension for Guile source code. So, I mean, (23/55)

it doesn't matter, but I'm just saying, like, if you want to do what everyone else is doing, that seems to be the thing that they're doing. And the first line that you need to type is hash bang, or I guess hash exclamation mark, slash user slash bin slash guile dash s, as in Sierra dash s. And then on the next line, and this is important and confusing, you need to do exclamation mark hash. So in Guile, you have to kind of like, you have to close your magic cookie line, which is not what we're used to as Linux users. We, generally speaking, we do the shabang, and that's it. In Guile, you have to close the shabang with a bang sh, um, to do that, or else you will get errors. It threw me off for way too long, so just remember in Guile, you have to close your shabang line. Apparently it needs to be on its own line, I haven't actually tested, but that's how it's written in the, in a lot of examples, so just don't skip over that. Okay, so you may remember maybe from Common Lisp that in order (24/55)

to display a simple hello world message, it was parenthesis pprint, I think that was like preprint or something like that. And then quote hello world is the argument to that statement, the second item in the list, or the first if you count pprint as 0, and then close parenthesis, and then you could do, actually I don't remember if we did that in Common Lisp, so that would be it, right? Well, in Guile, the function is not pprint, but display. Display is the function for printing. So parenthesis display space hello world close quote close parenthesis, and then parenthesis new line, all one word, n-e-w-l-i-n-e, close parenthesis, save, and I guess because I forgot to open Emacs with an ampersand, I will quit. And then I'm going to do a dot slash hello dot scm, and of course that's not working because it's not executable, that's fine, so I'll do an sh space dot slash hello dot scm. Oh, that did not do what I thought it was going to do at all. That's really funny. So this utterly failed in (25/55)

a very surprising way, and it seems to think that the dot scm extension is an image magic extension, and it launched image magic for me. Okay, so instead I'm going to do a chmod plus x hello dot scm, and then do a dot slash hello dot scm, and that one worked. Did not expect that result, that's very interesting. So anyway, dot slash hello dot scm, now the output is actually quite verbose, you'll probably notice, and what it's done is it is doing, it's compiling your dot scm file into a dot go, that is guile object file. And the guile object file, maybe somewhat puzzlingly, is kept secret from you, it's sort of stashed away in a separate place, I don't know why. I mean it tells you where it is, it's not exactly a secret, but I don't know why they put it somewhere else, it's kind of surprising. But yeah, they put it in like slash home slash cloud two slash dot cache guile c cache two dot o dash le dash eight dot two dot zero slash home slash cloud two slash demo slash guile slash hello (26/55)

dot scm dot go. And then I guess it must run that executable, because then in the, in my terminal I get a hello world. So apparently this is reflecting the sort of modularity of guile, and apparently it likes to create guile objects. I'm not 100% sure like what the theory behind all of that is, I do know that if I copy that full path to the go object and try to run it, it gets a permission denied. If I make it executable and try again, it says that cannot execute binary file exec format error. So it's a little bit strange, that convention, but that's fine, we'll continue on from here for now. And that was just to kind of highlight the basic process, but also to highlight the fact that the function names are going to be different. So p print, defund, set f, set q, all that stuff, just forget it. It's not something you need for guile, that's common lisp or emacs lisp and other stuff, it's not guile. Alright, so let's try to make a dice rolling application. Previously what we did in (27/55)

common lisp was we defined, we created a function, defund roller num, and then we p printed a random number, and the random number was scoped by a parse-integer function by taking the int number of our arguments and going from 0 to whatever that number was. So, in other words, to do the roller, we need a number, and that number needs to be parsed as an option, and then the option needs to be, the correct option needs to be selected and plugged into an argument for the random function. It also required us to create a, to access the arguments, it required us to create a random state, a random seed, and then we were able to execute the roller function. The exact way, and this is all written out in episode 405 show notes, so if you go to gnuworldorder.info slash hash 405, I think, it'll take you straight to that section. So it was defund roller num, p print random parse-integer int 0 num, and then set f user put args, set f random state make random state t, and then roller user put. So (28/55)

user put args was getting the command line arguments, random state was making the random seed, roller user put is executing the roller function with the input as user put. When we get into the roller function, the name of user put changes to num, because that's the argument I put for roller, I don't know why I did that, I guess one does it. And then p print random parse-integer int 0 num, that's just parsing stuff and converting it to, or using it as an argument. And that's how that was executed in Common Lisp. In Guile, it is, I guess technically I'm looking at the line count, it looks like it's longer in Guile, but I guess you might be able to argue that it's a little bit more elegant, I'm not sure actually. Anyway, let's do this. So the first line we know, shebang slash user bin guile dash e main dash s shebang, or bang she. So that's dash e as in echo, main dash s as in Sierra. What that does, apparently, is it creates, it allows Guile access to the command line arguments received (29/55)

upon execution. That's sort of what I am gathering from the documentation. The documentation also points to a module specific to parsing terminal options, command options. I looked into it, it was git opt dash long, but the sample code for that process, even though it said that it was much easier to use, was something like 20 lines all on its own, and it didn't work when I tried to execute it. So I quickly backed away from that because I didn't feel like that was worth really getting involved in, and frankly this is a lot better. The shorter version is better, at least in terms of understanding what actually is happening. So we're going with this. So that's the first three lines, technically, because I put the dash e main dash s on its own line after Guile. So really I have user bin guile and then the backslash to continue the line, dash e main dash s, and then I close the exclamation hash. So first thing first, I create the random seed. The syntax for that is pretty unique. It's (30/55)

different than anything I've seen before, and I'm just getting started here. So parentheses set exclamation mark. I don't know exactly what that means. The documentation is a little bit strangely obtuse about it. It introduces it, but then it says this is not a complete description of define and set exclamation mark because we need to introduce some other aspects of scheme before the missing pieces can be filled in. If, however, you're already familiar with the structure scheme, you may like to read about those missing pieces immediately by jumping ahead and following these references. And it kind of goes into some lambda alternatives, so I'm assuming set exclamation mark maybe technically is a lambda. It also says procedures with setters to read about an alternative form of the set exclamation mark syntax. And then it also says there's internal definitions. I kind of poked around, couldn't find an immediate answer, so I don't know to this day what set exclamation mark, what's the (31/55)

significance of that. So, oh well. Space asterisk, random dash state asterisk, and that apparently is kind of a special kind of variable. I almost sense that it's kind of like a built-in value, sort of, and that did exist in Common Lisp as well. Because we had asterisk args asterisk and asterisk args random state asterisk. So I believe, yeah, it's like a predefined value, sort of, or variable, I guess. Okay, so set exclamation mark asterisk random dash state asterisk parentheses random dash state dash from state dash platform parentheses parentheses. Set exclamation asterisk random dash state asterisk parentheses random dash state dash from dash platform parentheses parentheses. So that's the first line, and all that does is instantiate the random seed, and it is kind of just, it's just magic. I didn't look it up, I don't know how it happens. I mean, really, what's happening here is that we're saying, define a variable, or define a value for random state. Random state may or may not (32/55)

already be defined, and I think that might be the significance of set exclamation mark. I believe that set exclamation has something to do with setting a variable that already has a value. So we're kind of forcing a definition for random state, and the thing that we're putting into it is the results of a function called, or a procedure called, random dash state dash from dash platform. So that's actually what's happening there, with some allowance for me, not 100% understanding the nuances. Parenthesis, so that's, that's, that's the first, that's line five, it's done, we're walking away from it. It's opened and it's closed. Next we're going to define the roller function. So this is parentheses define. So in common Lisp we would have used, and in Emacs Lisp we use defun, D-E-F-U-N, which I absolutely hate. I hate that, that abbreviation as much, almost as much as I hate the Python def function. This is define. It's a beautifully self descriptive term. What, what are we doing with (33/55)

define? Well we're defining something. Admittedly it could be better, it could be like the word function, but from what I've seen I guess maybe in Scheme and Lisp, function isn't really necessarily, or rather in Scheme and Guile maybe the word function isn't necessarily used all that much and it seems to be procedure. So I'm not exactly sure about the details there, but either way I like the word define, so we're doing parentheses define space parentheses roller num, close parentheses. So that's our opening statement. We're defining a thing called roller and as a, as an argument, the thing that, as an argument roller accepts a value that we're going to call num in U-M as a number. Okay, so next we're going to do parentheses display, you remember display, it's the, it's the pprint of, of Guile. So parentheses display space parentheses random num parentheses parentheses parentheses. So that's done. That's a whole function that we've defined. We've defined a thing called roller, which (34/55)

accepts one value that we put into a variable called num, and then as a, as the action contained within this procedure, we do a display of the random function with an upper limit of num. By default, this random function goes from zero to, to, to whatever, whatever the upper value is. There is documentation on the random function, random number generation in chapter six, subsection six, subsection two, subsection fourteen, sorry, chapter six, section six, subsection two, subsection fourteen. That's what it is. Random number generation is on gnu.org slash software slash guile slash manual. You'll find it there. It is very confusingly written. I could sort of try to take you through the process of how I failed to understand what it was trying to identify for me. Let me see if I can replicate that because it is, it is quite confusing and I feel like going through it wrong might help you understand exactly how to do it correctly. I feel like half of the battle of getting to know Guile for (35/55)

me was understanding how to read their documentation because it got very, very confusing in some spaces, in some places, and they are not big on examples for some reason. They are really not fond of providing just actual examples from what I can tell. Okay, so, pseudo random numbers are generated from a random state object which can be created with seed dash angle bracket random dash state or datum dash angle bracket random dash state. I think you'll agree, dear listener, that that seems really weird and not very lispy. So I started an interactive, interactive environment for Guile and I pasted in seed dash angle bracket random dash state. And indeed it says dollar sign two equals hash bracket procedure seed dash angle bracket random state parentheses underscore close parentheses angle bracket. So I mean, it doesn't sound like an error. It seems like it's a success. So I don't know. Apparently, they're correct in the documentation, which, you know, that's good. It says an external (36/55)

representation, i.e. one which can be written with right and read with red. Actually, it doesn't say that. It says one which can written with right and read. But obviously there's a missing B there. A random state object can be obtained via random dash state dash angle bracket datum. So that's an external representation. And I don't exactly understand what they mean by that statement. You can paste in random dash state dash angle bracket datum. And again, it doesn't look like an error. But then again, I also don't know what we're getting. So that's interesting. And it doesn't give us a hint. It just says, I guess it's an external representation. I don't know what that means. The state parameter to the various functions below is optional. It defaults to the state object in the asterisk random dash state asterisk variable. Okay. And then it proceeds to sort of tell you about procedures, different procedures, along with the underlying, I guess, C function. And I'm not... It's rather (37/55)

confusingly done, I think. The first one is scheme procedure copy random state bracket state bracket. It returns a copy of the random state state. Okay. Well, that's not what I want to do. So I'm going to skip over that. The next one is scheme procedure random n state. This return, I'm reading it as it's written. Return a number in square bracket zero comma n closed parentheses, which was never open, dot. So I'm assuming once again that there's a typo here and that the square bracket is supposed to be a parentheses. It says it accepts a positive integer or real in and returns a number of the same type between zero inclusive and in exclusive. The values returned have a uniform distribution. So to me, that says that the function is random and n could be, let's say, zero comma state. And it's already told me that state is optional, so I'm not going to include that. So I'm going to just press return. And it says... It actually says this time that number... dollar sign four equals hash (38/55)

procedure random underscore hash colon optional underscore dollar sign five equals zero. So that's kind of almost like... that looks like success to me. So I'll do it again. Random zero. And this time it kind of gives me... gives me the exact same output. So random zero, same output. So if that's working, it's obviously not working as we would want because it is just giving me the same number over and over again. So let's... but then again, I've set some value to zero. So maybe it wants a higher value. So we'll do random 12. And again, no errors exactly, but it does just keep returning 12. So not too sure about what's going on there. So maybe actually state isn't necessarily optional. Maybe we need to point it to state. So we could do random... let's do zero again and then say asterisk random dash state because if I'm understanding correctly, that's a variable representing the results of our random seed. So random zero asterisk random dash state asterisk. Again, no error, but I've got (39/55)

a zero and a random state F99CB0. So nothing that I can identify as usable. And I can keep doing that over and over again, although I can't hit the up arrow or the control P to get the previous thing. So I have to type it out. But just trust me, if I type it out over and over again, I get the same results. So this took a really long time for me to finally figure out. And in the end, the answer was to kill that session, get a new one open, and then do the set exclamation mark random state random state from platform. And then parentheses random, let's say 12, close parentheses, and that gives me a zero. Do it again. It gives me a seven parentheses random 12, gives me a nine this time and so on. So it does actually work, but not in the sense that the documentation suggests that it should. Or at least not the way that I was reading the documentation. I guess upon rereading, confusingly, it's telling me, I think, scheme procedure random N state. State is optional, so N is actually the upper (40/55)

limit of what you want, which makes some sense, although later in the first line of the explanation says return a number in 0,N. So that's easy to overlook, I feel, that the zero is implied and also something that you're not supposed to include. And so you're really only supposed to give it the N value. So that's a little bit tough. I found it difficult to understand. And then the fact that at the very top of the document, it tells you, apparently, to just do the seed dash angle bracket random state and that that appears to work when you do it. And then confusingly, the actual thing that you need to do isn't mentioned until the very end of this document. And that's kind of the thing that unlocked most of this for me was that you just have to read down to the bottom to get the first step. And then the next steps, you can kind of mess around until they work for you. So that's a I would say that that is a very poorly written section of that documentation. And there's a little there's (41/55)

there's a little bit of documentation problem, I think, with with a lot of this. I was I found it very difficult to follow. But once you kind of get the feel for how they write, you can eventually get it. And then it's just a question of looking up, you know, the tasks that you want to achieve. So, for instance, trying to get the arguments off of a out of the terminal that you've typed. How do you get the arguments into your application? Took a while to figure it out. Dash E main dash s, the sort of qualifying line at the beginning of the script was part of it. And what what that does is it gives you gives you access to those arguments on the command line. So line 11 here, we've got I'm going to do a define parentheses, main space args, close parentheses. So I've just taken the arguments passed to this script and I've put them into a variable called args. Next line is define num parentheses string dash angle bracket number. And yeah, that's that weird notation that I didn't quite (42/55)

understand again. Apparently, in the conversion document, conversion number, converting numbers to and from strings. That's chapter six, section six, subsection two, sub subsection nine. It says that the following procedures read and write numbers according to their external representation as defined by R5RS. No idea what that is. It's some kind of scheme definition, I think. See the ICE9IL8N module for locale dependent number parsing. Scheme procedure number dash angle bracket string in square bracket radix close square bracket. That returns a string holding the external representation of the number n in the given radix radix. If n is inexact, a radix of 10 is used. The next next section says scheme procedure string dash angle bracket number string radix. And that returns a number of the maximally precise representation expressed by a given string. Radix must be an exact integer, either 2, 8, 10 or 16 if supplied. It boils down to that the default radix is 10, so you don't actually (43/55)

really even have to supply it. But the syntax is indeed string dash angle bracket number and in parentheses list dash ref args one, parentheses, parentheses, parentheses. So what have we done here? We've defined a function called num. And the arguments to this function are, rather, sorry, we've defined a variable called num. And the thing that we are putting into this variable, I should mention that, you define both variables and functions with the same keyword. Is that problematic? I think arguably yes. Anyway, define num, the arguments that we're putting into it is the results of the string to number conversion procedure. And the thing that we're feeding to string to number is the results of the list dash ref procedure, which looks at a list in Lisp. And that's, so obviously that's super important. List dash ref, you're going to use that a lot probably in Guile. List dash ref, and then we're looking at args, that variable we just now created, I think. When did we create that? No, we (44/55)

didn't create that. That's something that we inherit. We got args, and we're looking at the first one. And the reason that we're looking at the first one is because the function of this little dice roller script is going to only allow for one number. And that is the upper limit of the dice that you want to roll. And then finally, the last line of this little, of this section is roller, which of course invokes our roller function, num, close parentheses, close parentheses. I absolutely will include that code in the show notes. But let's give it a go. We'll do, um, I guess I'll chmod plus x dice dot SCM, and then I'll do a dot slash dice dot SCM, nothing. Um, it errors out because I forgot to give it an argument. So dot slash dice SCM 21, it returns 9. I probably need to put a new line in there somewhere because it returns it at the beginning of my prompt, which is kind of annoying. Where can I put that? Maybe at the end of this function here. New line. So I'm putting a new line at the (45/55)

end of the roller function after it's displayed, um, the, the number. And that seems to work pretty well. Dot slash dice dot SCM 21 returns a 1, for instance. And then a 9, and then a 2, and then an 11, and then a 9, and a 9 again, and a 3, and a 16, and so on. So that's a dice roller app in Guile. Like I say, it is very much like Lisp. If you're familiar with Lisp, even passingly, this will feel very familiar to you. But don't be tricked, it might feel a little bit too familiar to you, and you'll be trying to use functions that you remember seeing in your Emacs config, or that you remember hearing about in the Common Lisp episode, and none of those will work. Vocabulary is completely different, you just have to learn a new set of procedures in order to be able to write sensible code. But the syntax itself is going to be completely familiar to you, well, completely, aside from that weird dot, that weird dash angle bracket, the little, you know, ASCII arrow thing. That might feel more (46/55)

familiar to people who are, you know, used to C++ or something, but for me in Lisp, that seemed very, very foreign, and kind of like, almost like, surely I'm doing this wrong. And then once it worked, it kind of felt kind of cool, I kind of liked it. String to number, number to string. It is one of those things that's kind of, you know, actually pretty intuitive. But then again, as far as I can tell, it's really only something that happens as sort of a way of notating your function name, which, I don't know, seems a little bit less exciting. Either way, it's neat, it's cool, Guile is fun, if you like Lisp and Lisp syntax, then Guile seems like it's a great way to have another variety of Lisp available to you. If you're not familiar with it, or if you're not fond of it, then maybe it's not as exciting. But people do seem to like Guile, I mean, I know that it's being used in lots of kind of new and exciting GNU projects, like Geeks and stuff like that, so maybe it's something to look at, (47/55)

maybe not. It just depends on, I guess, what your preferences are for programming. I enjoyed it. Whether the way that it sort of feels is quite as good as Common Lisp, I'm not convinced. But then again, I mean, I don't have a whole lot of experience with the two, you know, to make an intelligent comparison. It's quite possible that some of the things that seem foreign to me in Guile are actually quite innovative and very useful, and I would love them if I was using it for a big project. But I'm not yet, so right now, if I need a Lisp scripting language, I can see myself kind of maybe defaulting to Common Lisp. But we'll see what happens, you never know. That's it, that's Guile, that's the Guile episode, so hopefully that was somewhat informative. I think less about teaching you Guile, certainly I'm not qualified for that. I'm less interested in teaching you Guile, as I am just saying that the path to Guile would probably be, you know, get comfortable with Lisp, or be prepared to get (48/55)

comfortable with Lisp, and then just understand that the functions or procedures or whatever that you're using in Guile are rather specific to Guile and or Scheme, and not so much to other things that you might see around. And because the documentation for Guile seems a little bit, I don't know, I wouldn't say that it's, I found the Guile documentation rather limited. I found the GNU manual probably the most useful, the most complete. It's probably kind of useful after a fashion. You might find yourself relying a lot on Scheme documentation and Scheme exercises in order to get good at Guile. It's a little bit, I felt echoes of GNU COBOL, where the tool is one thing, but the tutorials that you're working through are written for something else, and you kind of have to cobble stuff together, which kind of had surprised me. I had heard so much about Guile that I thought their sort of education infrastructure would be healthier and a little bit more, a little bit, it would have more to (49/55)

There are 2 pages
Pages