DrScheme: Insert Lambda Template Keybinding

DrScheme provides a very versatile keybinding system. Out of the box you get bindings that make it very easy to navigate and even refactor your code. One keybinding, insert-lambda-template, works by surrounding the selected code with a lambda function. By default, insert-lambda-template uses the lowercase lambda symbol λ rather than the word lambda. As DrScheme encodes its files in utf-8 it has got no problems with this (in fact DrScheme has shortcuts for inserting most other Greek characters), but if you use other tools to edit or process your source code you may find that they (quite disappointingly) choke on it. For that reason, I wanted to modify the keybinding so that it would use the world lambda rather than the symbol. There are two ways to go about doing this.
The first involves modifying the source code of DrScheme itself. This sounds harder than it is as it doesn’t even involve downloading the source code. When you install DrScheme, it includes a number of source files used to customize itself. If you wanted, you could look up this keybinding, change it, and re-run the setup program. I don’t like this approach, though, since it forces the user to re-build part of the program. That leaves us with the second alternative, a custom keybinding.
A custom keybinding is easy to implement and add. To write it, I copied the definition of insert-lambda-template and changed the lambda symbol to the word lambda. Next, I went through DrScheme’s Edit->Keybindings menu to select Add User-defined Keybinding. That is all it takes.
My keybinding file can be downloaded here.

DrSync: Automatically synchronize file changes in DrScheme v370 and above

DrSync is a plugin that saves your files on frame deactivation and reverts them on frame activation. This tool is of particular interest to folks who run external programs like version control or build related tools on files which they are editing inside of DrScheme.
Continue reading “DrSync: Automatically synchronize file changes in DrScheme v370 and above”

Low Exposure: IronScheme

Have you ever heard of IronScheme?

IronScheme [aims] to be a R6RS compliant Scheme implementation based on the Microsoft DLR.

These aren’t just nebulous goals either, they’ve actually got the interpreter up and running!
With so much development going on around the DLR right now; I’m going to pay extra special attention to when the *next* Lang.NET symposium is going to happen. It looks like a lot of fun!
Addendum: 24/10/08
ANN: IronScheme 1.0 beta 1

Using Scheme's Eval in Sandbox

One of the most tantalizing features that folks hear about Scheme is the eval function. While in reality, when it comes to meta-programming most modern Scheme distributions have evolved other mechanisms to do so, eval is still a big draw. The biggest shock most folks have when it comes to Scheme, though, is that you can only evaluate expressions in the top level environment. If eval holds your interest long enough, for perhaps any number of different different reasons, you will eventually reach the point where you want to do use it to evaluate code that you didn’t write (my inspiration came in the form of the Dolphin Smalltalk tutorial task where you write network chat clients that can send code to each other for execution). Whatever *your* inspiration was, though, you will also reach the point where you realize that you don’t necessarily want arbitrary code to be executed in the environment in which you are running your program; you don’t want folks sending (exit) for example, that can be pretty irritating. One way to work around this issue to to evaluate your code in a sandbox.
Here are three ways to do it with PLT Scheme: DynamicEvalCustomNamespace, DynamicUntrustedEval, and Sandboxed Evaluation.
Addendum 04/22/08:
Here is a link directly to the Schematics PLT package which provides “a library of useful procedures on namespaces”.

Want to chat about Scheme?

Email discussion lists and comp.lang.scheme are an excellent to start.
Another option is #scheme on IRC at Freenode; there is nothing like speaking to another human being about Scheme.
When you talk with folks; you learn faster and have a lot more fun. When you are really digging into a concept, the kind soul who answers your question at just the right moment can make the difference between learning the concept now, or in a few days. Not to say that learning is a race; it is just so much fun that I think everyone loves to learn the next thing!
An aside; I’ve found that my mastery of topics, and in particular the lack thereof, is revealed much more quickly to me when I open my mouth! I won’t miss a chance to do so!

Edwin: The Movie

MIT Scheme is a fine Scheme distribution. Their editor, Edwin, however, has always been sort of a mystery to me. I can’t find anyone that uses it, documentation that “speaks to me”, or even a user guide on how to get the most out of it. Aaron Hsu, psychically detecting another Schemer in need, recorded an introduction to Edwin that provides a nice peek into some of its features.