Following the helpful feedback on my proposed list of new features for uLisp I have now built a new experimental ARM version containing the most requested features, and I’d welcome your feedback.
You can download the new version from GitHub here: uLisp ARM Beta.
You can read a full description of the new features here: uLisp ARM 3.2 Beta.
Here’s a summary of the new features:
Line editor
If you compile uLisp with the option:
#define lineeditor
uLisp provides an input buffer, allowing you to correct mistakes by pressing the delete key, or typing backspace. The line is not submitted to the REPL until you press enter.
This is designed for using uLisp from a serial terminal rather than the Arduino IDE’s Serial Monitor.
Parenthesis matching
There’s also an experimental option: if, in addition, you include the option:
#define vt100
uLisp uses ANSI standard terminal codes to implement parenthesis matching, highlighting matching parentheses in inverse video as you type. However, on my terminal (Mac screen) this doesn’t work correctly once you type past the end of the screen, causing the line to wrap. This may just be a problem with screen’s terminal emulation, and I’d welcome feedback on this.
Arrays
uLisp now includes arrays, as a more efficient and convenient alternative to using lists with nth etc. With a 5000-element array it is on average approximately 20 times faster to access elements than with a 5000-element list.
Arrays in uLisp can have one or two dimensions. The size of arrays is limited only by the amount of available workspace.
Arrays will be useful for collecting data from sensors, or processing mathematical functions. When you save your workspace with save-image, arrays and their current contents are saved too.
Arrays are created with make-array, and accessed or changed with aref.
Outputting to a string
You can now create a stream that outputs characters to a string and returns it, using with-output-to-string.
Format
uLisp now supports a subset of Common Lisp’s format function, for formatting output neatly using a control string containing format directives; the directives supported are:
The ~a, ~s, ~d, ~g, or ~x directives for outputting values; these can also can include a width parameter after the tilde, and some can specify an optional pad character.
The ~{ and ~} directives which allow you to format elements in a list.
The ~% and ~& directives for outputting line breaks.