Common Lisp Naming Conventions

Over at the newly redesigned Common Lisp Wiki, CLiki, they have an excellent page on Common Lisp naming conventions. Most people that have done a non-trivial amount of Lisp programming will be at least dimly aware of many of these conventions but there’s also a number of rarer conventions that may be new to many.

Most Lispers know the “predicate convention:” predicates end with “p” unless the predicate contains a hyphen, in which case it ends with “-p”. Thus it’s zerop and simple-vector-p. But what about string-lessp? That seems to violate the convention and I’ve always wondered why. It turns out that the actual convention has a third part that says if a new predicate is formed by adding a qualifying prefix to an existing predicate, then the new predicate is formed by adding a hyphen between the prefix and old predicate and the “p” or “-p” at the end is unchanged. Thus when lessp is qualified with the prefix string we get string-lessp instead of string-less-p. Follow the link for the rationale for this rule. Of course, there’s also the grandfathered-in predicates such as null and equal that don’t honor the p convention at all.

There are other interesting notes about the conventions so even experienced Lispers are likely to find the page interesting. If you program in Common Lisp you should check it out.

Posted in Programming | Tagged , | Leave a comment

Randall Munroe on XKCD

The MAA has a great interview with Randall Munroe on every geek’s favorite online comic. Being the Mathematical Association of America, the interview concentrates on the more mathematical of the cartoons. Munroe talks about how he comes up with the ideas for and how he solves the problems that the cartoons explore. You may be surprised at how he arrives at some of those solutions.

If, like me, you’re an XKCD fan, you should definitely take a look at the interview. It’s interesting and gives some insight into how Munroe produces our favorite cartoon.

Posted in General | Leave a comment

Bookmarks

I’ve been rewatching some of Tim Visher’s VimGolf for Emacs videos (where are you Timmy?) and one of the things that struck me the second time through was his demonstration of Emacs bookmarks. I remembered my old post on opening frequently accessed Emacs files in which I wrote about storing frequently accessed files in registers so that you could jump to them with【Ctrl+x r j】. Many of the commenters on that post told me that I really should be using bookmarks for that sort of thing. For unfathomable reasons I have resisted using bookmarks but Visher’s videos spurred me to give them a try. Serendipitously, Xah Lee’s blog had a short piece on bookmarks with a pointer to his bookmarks tutorial so I was able to get started quickly.

At first, I used them as Visher did in his videos: to jump to parts of the Emacs manual. How much easier to just type【Ctrl+x r bregisters to bring up the documentation on registers than to bring up Info with 【Ctrl+h i】 and navigate to the register node. Then I remembered the reason I wrote that post on opening frequently accessed Emacs files to begin with so I added bookmarks for my tax file, my steps.org file, and my init.el file.

I keep my bookmarks file in a git repository so that it gets synced between my machines. I noticed that this can be a bit tricky because even if git updates your bookmark file, Emacs will overwrite it the next time you save your bookmarks. For that reason, I added the following line to my sync-repos function

That means that when I pull in changes from the other machines my bookmarks will be updated at the same time. It can be hard to get this right because bookmark-load and its siblings will, by default, add to the current bookmarks rather than replacing them. The second argument to bookmark-load says to overwrite the bookmarks rather than add to them.

Posted in General | Tagged | Leave a comment

Using Acme

A while ago I wrote about Russ Cox’s Tour of the Acme Editor. Acme has a lot of great ideas. It is, in some sense, the opposite of Emacs. Where Emacs puts every conceivable functionality into the editor, Acme has minimal internal functionality but makes it easy to access external tools. In that, it is the incarnation of the Unix way.

For an Emacs guy, however, there are some problems. The most important is that Acme is totally mouse-centric. There is no cursor addressing at all. Want to move down a line? Don’t bother with the arrow keys let alone 【Ctrl+n】. You have to click on the line you want to go to. Like syntax highlighting? Sorry.

A lot of this, of course, is a matter of what you’re used to. Editors are an intensely personal choice and most of us find it hard to change. With that in mind, it would be interesting to see how well an established Emacs user could adapt to Acme. Fortunately, Vince Foley has done the heavy lifting for us and written a review of Acme from an Emacs user’s point of view. If you’re like me, you’ll find his conclusions interesting. I didn’t agree with everything he said—Acme’s color scheme, for example, is just fine with me (being close to my Emacs scheme)—but overall I found myself nodding in agreement.

Foley says he doesn’t think Acme will replace Emacs for him and I don’t think it would for me either. I really like how Emacs recapitulates the Lisp Machine milieu and can’t imagine giving it up. Still, I’d be interested in hearing about the experiences of any Emacs users who’ve tried Acme.

Posted in General | Tagged , | Leave a comment

What We Need In An Editor

Vivek Haldar has an interesting post in which he asks, essentially, what we need in an editor. He remarks that most people seem to want an editor that “looks good” and has certain performance and feature aspects that no one can agree on.

Haldar notes that other than having a readable font and decent syntax coloring, the “look” of an editor doesn’t matter. None of that will surprise the average Emacs user but he does make a point that we Emacs aficionados seem to understand subconsciously: like fine wine, a good editor is an old editor. That serves as a welcome riposte to the oft stated criticism that Emacs is old technology and that modern and presumably hip developers are using something with lots of dialog boxes and whatnot. Of course, the point is that Emacs has been around long enough to adapt to its users and their needs.

His Emacs user taxonomy is also interesting. I don’t agree with every classification but I do think he was it mostly right. What do you think? Do you recognize yourself in one of his categories?

Posted in General | Tagged | 4 Comments

Learning Elisp

Xah Lee has an excellent post on learning how to program in Emacs Lisp1. His idea is to start with your favorite programming mode, disable it, and program your own. Begin with just doing syntax coloring and then slowly add features as you need them. Over the course of, say, a year you will build a robust mode for your language and learn a ton of Elisp.

I find that the best general method for learning a piece of technology is to use it to solve a problem. If you have some editing problem that needs solving, then try to do it with Elisp (Lee’s Elisp Tutorial can be a huge help here). If you don’t have some problem you need to solve but just want to learn Elisp so that you can make better use of Emacs then Lee’s suggestion of implementing a major mode for your favorite programming language is a good one. It may take some time but you don’t have any problem—urgent or otherwise—to solve so time shouldn’t be an issue. Either way, you’ll end up learning a lot of Elisp and be able to use it to make more effective use of Emacs.

Update: Lee notes in the comments that he has made this post into a separate page that you can find here.

Footnotes:

1 With Lee’s current blog there is no way of linking to a particular page. Go to his blog by following the link and search for “2012-11-03 ” to find the How Do You Actually Learn Emacs Lisp and Do Something with It? post.

Posted in Programming | Tagged , | 2 Comments

Apple’s Poisonous Touch?

As regular Irreal readers know, I mostly avoid the tech wars and especially tech wars involving Apple. I use Apple products and like them very much. I also use Linux, FreeBSD, and various other platforms so although I admit to admiring Apple products, I don’t think it accurate to describe me as a fan boy. Nonetheless, a recent Register article has such an outrageous headline that I’m forced to leap to Apple’s defense.

The article in question is headlined Apple’s poisonous Touch silently kills the GNOMEs of Linux Forest. That’s a lot of red meat so you might think it’s about Apple sending out their covert operations ninjas to sabotage the powerful GNOME opposition. But no. It turns out Apple’s dastardly plan was to do UIs correctly. By unfairly realizing that tablets and laptops have different UI needs and failing to conflate those needs into a single desktop environment, Apple poisoned the GNOME project.

Seriously? That’s what the Register calls “Apple’s poisonous touch?” Actually, the article itself is a reasonable exposition of the difficulties that the GNOME project finds itself in and the reason for those difficulties. It hardly mentions Apple at all except as an example of doing things right. GNOME’s problems are of their own making just as they’ve always been. Apple has nothing to do with it.

Judging from the disconnect between the headline and the article itself, it’s likely that the sensational headline was written by an editor with a feverish imagination rather than the author himself. No matter. At the end of the day the Register bears responsibility for an outrageous and irresponsible headline. If you were wondering why the technical press is so often the object of ridicule, now you know. I can hardly wait to hear what Gruber has to say.

Posted in General | Tagged , | Leave a comment

DOS Amplification Attacks

Matthew Prince over at the CloudFlare Blog has a nice post on DNS Amplification DDos Attacks. He starts by explaining that DNS amplification attacks are descendants of the old Smurf Attacks. He goes on to show how they work and what steps everyone running a DNS server should take to help prevent them.

An interesting post for anyone who’s wondered how these attacks work or how CloudFlare manages to deal with them. Definitely worth a read.

Posted in General | Tagged | Leave a comment

SBCL 1.1.1 Is Out

Steel Bank Common Lisp 1.1.1 is out. As usual, compilation and installation were a snap. Out of irrational paranoia I always run the verification tests after I compile. Of course, everything was fine: all the tests except those expected to fail performed as expected.

This version fixes some bugs, adds some enhancements for the SPARC platform, and adds experimental threads for the Windows platform. You can see the details in the release notes.

I’ve been using version 1.1.0 without any problems since it came out and expect similar results for the new version. Updating is so easy (even if you compile it yourself) that there’s no reason to delay. Download the sources or binary from the SBCL Download page and start Lisping.

Posted in General | Tagged , | Leave a comment

Elnode Video

Nic Ferrier’s Elnode project is a great example of the power that Emacs and Emacs Lisp can deliver. Its almost unbelievable that you can run a Web server inside Emacs, but that’s what Elnode does. Once again we see in Emacs the echo of the Lisp Machine.

Nic has put up a video that shows off some of its capabilities as well as how to install and configure it. He also has a longish post on his blog that describes Elnode, its capabilities, and its performance. It’s available from Marmalade so installation is a snap if you’ve like to try it out.

Posted in General | Tagged | Leave a comment