PicoEdit: Editor/IDE for uLisp - now available

Hi,

I’d like you to know there is a tiny IDE (or rather a screen editor with additional useful features) available for uLisp on the PicoCalc: GitHub - ErsatzMoco/ulisp-picoedit

Features:

  • Real screen editor, unrestricted length of lines
  • Copy/Paste/Delete for lines or marked range
  • Directly run your code from within the editor - single lines, marked range or whole buffer
  • Help system makes built-in documentation available
  • Search function
  • Second edit buffer for looking into other code or copying it from SD card or the running system
  • Full SD card support including file deletion
  • Restricted set of special characters/umlauts accessible (currently German set)

Why Lisp? Have a look at the excellent uLisp by David Johnson-Davies. It can really do an awful lot, see plenty of impressive examples on the site. PicoEdit itself is written almost entirely (99%) in uLisp. UF2 currently available for the Pico 2 (W), which makes sense because of the larger RAM. But the editor should run on the old Pico as well.

Note that there also is a version of this editor for use with a standalone uLisp machine based on the Teensy 4.1: GitHub - ErsatzMoco/ulisp-lispbox: Self-contained uLisp computer using Teensy 4.1 and TFT with RA8875 controller

5 Likes

(post deleted by author)

This looks great! I can’t wait to check it out! Any recommended resources for learning uLisp for the PicoCalc?

Actually I think the best resource for beginners is the uLisp Website - David, the author of uLisp, explains each and every step very well, there are tons of tutorials and examples. His approach is to show that no one needs to be afraid of this ancient programming language, that it’s in fact worth dealing with. Following his explanations you will immediately experience success and motivation. In fact, CommonLisp (which uLisp is a subset of) loses its “strangeness” really quickly, other languages like Python conceptually build upon it a lot. Just don’t let scare yourself by some strange reserved words, their names have historical reasons. Others are self-explanatory. Although it’s against the Lisp convention I also recommend to place the infamous parentheses just like the brackets around program blocks in, say, C/C++. Personally, I can read my programs much more easily that way.

Once you’re ready to dive into Lisp a bit more, do it like almost almost everyone and read the standard book “On Lisp” by Paul Graham. It’s really old, from 1993, so be prepared for it not being too fancy in terms of layout and stuff. But the book explains the concepts behind Lisp very well and is officially available for free nowadays, just search for it.

Last thing: IMHO Lisp, esp. uLisp, is not retro at all - it’s definitely future-proof, just have a look at the impressive list of microcontrollers that are supported out of the box.

(Sorry for posting under a second name - I got flagged since I tried to post the URL of the uLisp website as a third link, OMG. I guess no-one will ever remove the block in this forum, so I’m going to use this new name.)

1 Like

Putting the closing parens at the end of a given line is easy if you’re using an editor that supports highlighting matching parens.

One thing to watch out, though, with uLisp is that ; stops at the next (, not at the end of the line, because uLisp was originally meant to be used with the Arduino IDE, and its serial monitor program strips out newlines.

Luckily, PicoEdit does support parenthese matching! (Forgot to mention it since a Lisp editor absolutely must support this.)

I figured it did, but I wanted to point it out for people who are like “but all those parens are hard on the brain”.

This is such a better editor than the ulisp edit function, and as a newb I really needed that matching parentheses support. Brown might me a little hard for my eyes, is there a way for me to change the pallet for higher contrast?

Glad you like it! Yes, you can change the colours (as a first direct measure I recommend to turn up brightness about 5 to 6 steps).

To experiment with different colors start the editor with

(se:sedit ‘se:init)

The first few “defvar” lines you see there represent the different RGB colors used. Edit the values to your liking, then press “F5” and bind the function you just edited to its original symbol name that is suggested in the edit line: se:init

The editor quits, and when you restart it, your new colors are used. You may opt to save this changed function to SD card.

When you’re satisfied with the colors, you need to compile PicoEdit within the Arduino IDE to your own UF2 file to make the changes permanent:

Clone the repo from Github - or just download “ulisp-picoedit.ino”, “PicoEditExtensions.ino” and “PicoEditLispLibrary.h” and throw them into a directory called “ulisp-picoedit”. Then open “PicoEditLispLibrary.h” in an editor and navigate to the function se:init. Enter your color values and save. Open “ulisp-picoedit.ino” in the Arduino IDE and install the (very few) necessary prerequisites there, please refer to uLisp - PicoCalc uLisp Machine .

Now choose your board for compilation (again please see the aforementioned webpage for the correct settings), then choose “Sketch/Export Compiled Binary” from the menu. After successful compilation this will create a subdirectory “build” within your “ulisp-picoedit” directory, and in there you will find the UF2 you can then copy to SD card and install.

I know this sounds complicated, but it really is not. Since the editor is written in uLisp, you can modify it at runtime (and therefore try out different things as described). The process to create your own UF2 is almost identical to flashing a board using the Arduino IDE.

Sure it would be nice to have a different method to change the color scheme. It would be possible to refer to some configuration file on your SD card, but I haven’t implemented that yet.

One last thing: The “brown” scheme is supposed to be “amber” like in the really old days when computers with amber CRT monitors were available because this actually reduced the strain on one’s eyes. I personally don’t like high contrast color schemes, that’s why I opted for this one, but that’s entirely subjective, of course.

Thanks for the tips! After using “(se:sedit 'se:init)” and experimenting with values, I found a color scheme that I liked!

Just saw on github that you released a new version 7 hours ago, so I’ll save my config to the SD card separately and download your new release!

I was having a bug on startup where it seems like the terminal was frozen and then it would start working after a few seconds, or it just wouldn’t work at all. Can’t tell if that’s more the picocalc’s or ulisp’s fault, but here’s hoping that bug disappears lol

Great! Yes, use the new “release”, permanent parenthese matching is a lot faster in this one and as stable as it should be.

The phenomenon at startup you describe is twofold: uLisp needs a bit of time to read and apply the Lisp Library (which contains the editor and so on). On the other hand the REPL does not show its prompt on the ClockworkPi after having interpreted the Lisp Library, I’m not sure, why. But in sum it’s no big deal - just give uLisp three seconds or so to gather everything. After that you should (reliably) be able to start entering stuff.