Why Learn Scheme

Back when I was learning Scheme, my go to implementation was DrScheme. It had great libraries, an excellent IDE, ran on Windows, Macs, and Linux, and produced good standalone code. Eventually it drifted away from the Scheme specification and was renamed DrRacket. It’s still a great environment and a good way to get started with Scheme.

Micah Cantor, a student at Grinnell College, provides his answer to the question, “Why should I learn Scheme?” The question was occasioned by the fact that his introductory programming course was taught using Racket and there was a lot of student grumbling about wasting time learning a language they wouldn’t use instead of one that could get them a job.

Putting aside the fact that a liberal arts education is different from a vocational education, the question deserves an answer and Cantor provides a pretty good one. The short answer is that Scheme and the functional programming paradigm teach a new way of thinking about writing programs and solving problems.

A good example is recursion. The usual introduction using a C-like language involves silly examples like factorials and Fibonacci numbers: problems that are ill suited to a recursive solution even though their definition maps naturally into recursion. In Lisp dialects—especially Scheme with its guaranteed tail call optimization—recursion is the natural iteration mechanism and one of the primary tools used by Lisp programmers.

Suffice to say that learning Scheme or some other Lisp is life changing for a programmer. I know this is true because it happened to me. After almost an entire career in programming I learned Scheme and read SICP and it changed they way I think about and practice programming.

Posted in General | Tagged , | Leave a comment

An Example of RSS Use

Chris Hardie is, like me, a believer in RSS and considers it an important protocol that can be used for more than just following blogs. He considers the example of a municipal website that posts information of concern to its citizens. Suppose, he says, that a water main breaks, the water supply is compromised and the city tells its citizens to boil their water. When the water supply is safe again, the city will post an alert letting everyone know that they no longer need t boil their water.

If you’ve ever been through something like that you know it’s a pain and that you want to stop as soon as you can. What to do? You can check the city’s Website every time you need water but who wants to be checking a Website all the time?

But suppose the Website had an RSS feed. It’s easy to leverage this into an alert by piping into something like Slack or a simple notification app. The problem is, what if the city’s Website doesn’t have an RSS feed as many don’t.

Hardie has a couple of solutions but they’re complicated and more work than most people would be willing to do. That leads Hardie to make a plea: if you’re a Web developer or responsible for deploying one, please provide an RSS feed. It’s not hard and it can make a lot of difference to your users.

Posted in General | Tagged | Leave a comment

The Year 2038 Problem

All of you Unix heads know about the coming Unix apocalypse. On January 19, 2038, the 32-bit Unix time variable will overflow and Unix will suddenly think it’s December 13, 1901. Except, of course, virtually all extant Unix systems now have time_t defined as a 64 bit integer, which covers us for roughly 20 times the age of the universe. We’re probably safe.

So problem solved? Silent says no, the year 2038 bug is alive and well. Of course, time_t is in no danger of overflowing but there’s still code about that implicitly assumes Unix time is 32 bits. As the example in the post shows, the dependency can be quite subtle. In this case, the villain is a macro that multiplies two 32-bit integers to yield a 64-bit result. It’s used to convert Unix time to a Windows FILETIME value.

Silent has launched a project to hunt down all the places this code is used and provide fixes. Take a look at the post if you’re interesting in helping.

In the mean time, if you want to keep track of things in a graphical way you can use the Emacs function hanoi-unix. It that makes you anxious, try hanoi-unix-64 that shows the same thing but for a 64 bit time_t. Using the Tower of Hanoi puzzle to count down to the end of time is not as whimsical as it seems. According to the legend of the Tower of Brahma, a 64 disk version of the game is being played by priests in the Indian city of Benares. When the puzzle is complete, the legend says, the world will end.

Posted in General | Tagged , | Leave a comment

The Bash Bible

Years ago I remember reading in Kernighan and Pike’s The Unix Programming Environment a quote about how the shell was very often their preferred programming language:

When you’re faced with writing a new program, there’s a natural tendency to start thinking immediately about how to write it in your favorite programming language. In our case, that language is most often the shell

It’s easy to see why. Programming in shell is quick and easy and you can use interactive programming techniques to build your application. It might seem like the shell is a blunt instrument but I’m often amazed at how large, robust applications can be built in shell. At the same time, it’s possible to perform low-level operations in shell.

Dylan Araps has curated a collection of pure Bash alternatives to several external programs. At the same, the collection demonstrates how to perform various low-lever computations such as removing duplicate array elements and much more. All this is collected in his Pure Bash Bible Github repository along with a handy, clickable table of contents.

If you write shell code or would like to, this is a valuable repository to bookmark or clone. You can also get a hardcopy from Leanpub if you prefer dead tree books.

Posted in General | Tagged , | Leave a comment

Delivery Robot Traffic Jam

One of the reasons I love being in New York City is that you can get virtually any type of food delivered at any time. Tampa is hardly a backwater but pre-covid we didn’t have a robust food delivery infrastructure unless you wanted pizza. Of course, all that’s changed now. Just like the Big Apple, we here in Tampa can get a meal or even our groceries delivered to our door.

Humans driving cars around to deliver food doesn’t seem all that efficient so, of course, the Geek in me is interested in other solutions. One such solution—probably best suited to smaller areas such as campuses—is the delivery robot. If you haven’t seen one, think of a beer cooler on wheels. They autonomously navigate from the provider to your door.

It’s easy to imagine a lot of ways things could go wrong but here’s one that didn’t occur to me:

Posted in General | Tagged | Leave a comment

Ibuffer

This tweet from Mickey

reminded me of something I haven’t thought of since I started using Emacs more than 15 years ago. Very early on I learned from somewhere that I should use ibuffer instead of list-buffers. I couldn’t even remember how I made the substitution and had to look. Back then I didn’t know very much Elisp so instead of remapping Ctrl+x Ctrl+b like I’d do today, I simply aliased ibuffer to list-buffers.

I can only concur with what Mickey says: just stop using list-buffers and change to ibuffer; you won’t be sorry. The only question in my mind is why ibuffer hasn’t replaced list-buffers as the default. It’s hard to imagine that anyone prefers list-buffers but those who do would still have access to it but the default would be the much more sensible ibuffer.

Posted in General | Tagged | Leave a comment

More on Google’s Poor Search Results

Back in January, I wrote about a Twitter thread concerning poor Google search results. The complaint was almost all the results were ads. DKB has a new post that covers the same ground. He says that Google is dying and reddit is now the search engine that everyone uses.

Neither of those two claims seems valid. After all, no one thinks that Google, who just had record profits, is literally dying. And how would you even use reddit as a search engine? DKB provides the needed context in his post. What is actually dying is the quality of Google search results in certain categories. Those categories are precisely the ones that attract advertisers. If you ask Google who the 32nd President of United States was, you get a accurate answer and probably little advertising. If, on the other hand, you search for a review of a particular late model car, your results are apt to be mostly ads and SEO engineered content.

That’s where reddit comes in. If you ask reddit about that same car, you’re going to hear from real people who doubtless have strong views but not a vested interest in getting you buy one. So DKB’s claim that reddit is the “most used” search engine should be understood to mean that people are now appending “reddit” to their searches as a way of finding out what reddit has to say on subjects whose results are abused by ads and SEO.

Take a look at the post to see the whole argument. You may or may not agree but it’s one more indication that Google is failing in their primary business.

Posted in General | Tagged | Leave a comment

Own A Color

Most Irreal readers are, I’m sure, like me in their skepticism of the NFT concept. It just wreaks of a scam to me and the most generous way of describing it is as a reincarnation of the Netherlands famous Tulip craze but without the flowers.1 Of course, it’s a verity in life that things can always get worse and this holds in the NFT domain as well.

Now, an enterprising innovator has expanded the NFT concept to the selling of colors. Just imagine, you can own a color and anyone using that color in an NFT would have to pay you. It’s like the spawn of a mutant copyright law and Brooklyn Bridge grift: Let’s take something that belongs to us all and use copyright law to claim we own it.

It’s not quite as outrageous as it seems because the “ownership” would apply only to colors used on NFTs within the Color Museum NFT marketplace. But why would anyone do this?

Let’s say you have a crude picture of an ape that you want to offer as an NFT. You could choose to sell it on the Color Museum marketplace and pay a fee for whatever colors you happen to use or you could sell it in a marketplace such as OpenSea that recognizes colors belong to us all.

Really, the whole thing—whether or not you’re trying to sell colors—is just silly and no one who values their time or money will have anything to do with it. For the others, I have a bridge they may be interested in.

Footnotes:

1

On the other hand, Paul Graham advises caution before dismissing NFTs.

Posted in General | Tagged | Leave a comment

Symbols in Lisp

Joe Marshall over at Abstract Heresies has a post that makes a point that’s easy to forget: Lisp has symbols and those symbols should be used in preference to strings or integers to represent arbitrary state constants. Most other languages don’t have symbols so you’re forced to use strings or enums for those state constants.

For example, a file-reading function in a non-Lisp language might return -1 or some other integer on end-of-file. In Lisp, you would simply return a symbol such as ’eof. As Marshall says, strings are composite objects with their own functions to manipulate them. Symbols are atomic objects that don’t really have any structure. Symbols are basically pointers to a memory location so it’s very efficient to implement things like comparisons.

It’s a short and simple post but, as I said, a useful reminder.

Posted in General | Tagged | Leave a comment

Words and Ideas

Paul Graham has a new essay up that discusses words and ideas. It’s an interesting piece that reminds me of one of my favorite quotes. The quote from Daniel Boorstin—a University of Chicago historian and the 12th Librarian of Congress—is “I write to discover what I think.1” I first saw it years ago and it made a big impression on me. Indeed, you can think of Irreal as a result of that impression.

Graham’s point is slightly different: you can’t think until you write. Or, at least, you can’t have fully formed thoughts, you can’t completely understand your thoughts until you try to explain them to someone else by writing them down. In Graham’s words,

If writing down your ideas always makes them more precise and more complete, then no one who hasn’t written about a topic has fully formed ideas about it. And someone who never writes has no fully formed ideas about anything nontrivial.

That seems provocative—and, of course, it was meant to be—but he has a point and justifies it in the essay. As with all of Graham’s writing, it’s definitely worth taking a few minutes to read it.

Footnotes:

1

Actually, the full quote is a bit wittier.

Posted in General | Tagged | Leave a comment