Tip: composing uLisp programs in a Common Lisp editor


#1

I thought I’d share a tip that is useful to me:

I often compose uLisp programs in a Common Lisp editor; in my case it’s LispWorks (ps there’s a free version), but this probably applies to any version of Common Lisp. I can then copy and paste the program I’m editing into the Arduino IDE Serial Monitor, or a terminal, to test it on the board I’m using.

The advantage of this is that you get parenthesis matching, and automatic pretty formatting. But the automatic formatting doesn’t work correctly for uLisp special forms such as with-i2c, bind, etc that don’t exist in Common Lisp.

The solution is to define these as dummy macros by evaluating (ignore the error):

(defmacro with-i2c (&body body))
(defmacro bind (&body body))

Then automatic formatting works correctly for these too.


#2

I occasionally use Dr. Racket for editing uLisp code. Its made for Scheme/Racket but it works well enough for things like auto indentation and parentheses matching in my experience, supports parentheses based navigation, and is easy to install and learn. Here’s a page that talks about how to navigate s expressions with the editor


#3

Hello,

Thanks a lot for sharing. Did you use the standard:

#lang racket ?

Or a special dsl / macro is needed for ulisp?

Best regards,