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,


#4

I use #lang racket but its possible that another language works better. Or maybe we can even write something to make uLisp work really well, but I haven’t looked into it.


#5

Hello,

Thanks a lot for your feedback.

Ok, I will give it a try later. I just found a serial driver.

For anyone starting to learn programming, I would still suggest checking htdp.org, even today in the fancy days of large language models.

Best regards,


#6

The Little Learner - Straight Line to Deep Learning (https://mitpress.mit.edu/9780262546379/the-little-learner/)


#7

I feel it’s most convenient when the text editor doesn’t consider s-expressions as just text with matching beginning and end characters. Structural s-expression editing was pioneered by Interlisp and we’ve been regressing ever since by treating s-expressions as text. Our syntax is basically lists so it’s convenient to be able to edit forms in the same way we’d edit lists and not worry about the character concerns.

It’s very nice to be able to move them around freely.


#8

Hello,

Thanks a lot for the link! I didn’t know about that book. We should probably create an updated list of Lisp/Racket/Scheme books.

In practical terms, the main contribution of htdp.org from the perspective of a newbie or student is the pedagogical approach. It combines the book, the IDE ( so far I understand that DrRacket was in part developed based on feedback from middle school kids and teachers), and the languages (Beginner BSL, Intermediate, etc.).

Not to mention that you are not just learning to program, but learning how to systematically design programs. That is, per se , a quite valuable skill in any area—even more so now that AI models are literally scanning and “learning” the whole software corpus.

Here is a quite interesting talk regarding this → Matthias Felleisen: The First Year

For the German speakers, here you can find a learning guide, from the Universität Tübingen (Prof. Dr. Klaus Ostermann) also based on HtDP .

Best regards,