Paolo Amoroso's Journal

Tech projects, hobby programming, and geeky thoughts of Paolo Amoroso

I'm writing another Interlisp program, Sysrama, an Interlisp documentation tool for presenting information on the Lisp objects of a program. It produces reports that list the types and signatures of functions, the fields of records, global variables, property lists, Executive commands, and more.

The way I reference the details of Lisp objects when coding gave me the idea for Sysrama.

I often forget the names and signatures of the functions or the names of the record fields I need. Browsing or looking up the code for referencing them is a source of friction.

Interlisp comes with the powerful program analysys tool Masterscope that gives its best with answering specific questions on the internals of programs. But it has a steep learning curve and it doesn't provide the kind of big picture view I seek. Instead, I wanted a simple tool for producing an overview of the main Lisp objects in a program.

This is a sample report Sysrama prints on another of my Interlisp programs, Stringscope:

Sample output of the Sysrama documentation tool for Interlisp.

The main sections group objects under the same File Manager types, such as FNS or RECORDS. This is because Sysrama can extract information only from programs under File Manager control.

Suppose you want to analyze the Lisp program MYPROG. Once Sysrama is in memory, load MYPROG:

(LOAD 'MYPROG)

To have Sysrama print a report with information on MYPROG evaluate:

(SUMMARIZE 'MYPROG)

You can narrow down the information to specific File Manager types such as FNS and RECORDS:

(SUMMARIZE 'MYPROG '(FNS RECORDS))

or to specific objects like the function MYFUN:

(SUMMARIZE 'MYPROG 'FNS 'MYFUN)

More documentation is available at the project repo.

Sysrama already does most of what I had in mind but I'll implement a few more features.

I'll tweak the reports to show more information on some Lisp objects. And I'll add the ability to redirect the output to a scrollable window rather than to the primary output stream. By default Interlisp windows don't save the output history and can't be scrolled back, so such a feature will help review reports that don't fit in a window.

#sysrama #Interlisp #Lisp

Discuss... Email | Reply @amoroso@fosstodon.org

Medley is a rich development environment but it's missing a test framework. Or so I thought. To fill the supposed gap I wrote Femtounit, a tiny — hence femto — unit test framework for Interlisp.

I wanted a small framework simple to port to or write for Interlisp, yet useful in practice. At less than a couple dozen lines of code, Femtounit took very little effort to design and write as it's based on the PCL test framework Peter Seibel described in Chapter 9 of his book Practical Common Lisp.

I reused much of Peter's design and code, adapting it to Interlisp and tweaking the reporting of tests. Femtounit outputs a single period character for every passed test, unlike the full report his framework prints.

Using Femtounit looks like this:

Usage of the Femtounit unit test framework for Interlisp.

Suppose you want to test this function that returns the square of its argument:

(DEFINEQ (SQUARE (X) (TIMES X X)))

You may define a TEST.SQUARE test function like this:

(DEFTEST TEST.SQUARE ()
  (CHECK.EXPECT (EQP (SQUARE 1) 1)
                (EQP (SQUARE 2) 4)
                (EQP (SQUARE 3) 9)
                (EQP (SQUARE 4) 16)))

To run the tests, just call the function:

(TEST.SQUARE)

which will print a period character for every passed test:

....

Some documentation is at the project repo.

After I finished the initial code of Femtounit, Larry Masinter pointed out Medley does have a test framework, and quite an advanced one. This system, which the Medley documentation simply calls test system and is much more than a framework, was originally designed to test Interlisp and its environment. The code is now in one of the Medley repos.

I thought I explored every nook and cranny of Medley and its documentation, yet I missed the test system. The system is interesting in itself and I'll use it for most of my code.

But Femtounit is a fun little learning project I still want to proceed with. It'll teach me how to integrate the framework with Interlisp for editing unit test definitions with the SEdit structure editor, as well as saving the definitions to files and managing them with the make-like File Manager tool.

#femtounit #Interlisp #Lisp

Discuss... Email | Reply @amoroso@fosstodon.org

Reading is the main use of my new Lenovo Tab M10 Plus 3rd Gen tablet, yet I hadn't checked out its reading mode. Now I did. Reading mode sets a color palette that's easy to the eyes such as black and white, systemwide or per app. Nice, but I can get a similar effect by changing the page color to sepia in Google Play Books and other reading apps.

#Android

Discuss... Email | Reply @amoroso@fosstodon.org

I'm back to work on Braincons, a Brainfuck implementation I'm developing with Medley Interlisp.

The new code I wrote implements the virtual machine (VM) and executes the Braunfuck instructions. Now Braincons can create and reset a VM, load a program into it, and execute the program until completion or for a designated number of steps.

The Lisp record BRC.VM represents the VM and holds the Brainfuck program, memory, machine state such as the instruction and memory pointers, and virtual I/O devices. All the functions that operate on the VM accept a BRC.VM record as an argument, update it as necessary, and return the record.

To decouple as much as possible I/O from other subsystems, BRC.VM contains the IN and OUT fields to hold a Lisp input stream and a Lisp output stream.

Any functions that need to read data or display output on behalf of the VM can do I/O to the relevant VM streams. This adds flexibility as most Interlisp text and window output functions accept streams as arguments.

Having the book A Philosophy of Software Design fresh in my mind after recently reading it, to design the Braincons VM I deliberately sat down to think about and write a specification of how the features needed to work. Although the book presents a lot of material I haven't absorbed yet, this preliminary work helped me design a relatively small and clean VM interface and saved some code rewriting.

Now that Braincons can parse, compile, and execute Braunfuck programs, the next step will be to build the user interface for editing and running programs, as well as inspecting the VM and its state.

#braincons #Interlisp #Lisp

Discuss... Email | Reply @amoroso@fosstodon.org

I bought a Lenovo Tab M10 Plus 3rd Gen 10.6” Android tablet to replace my old Lenovo Tab M8 HD 8” tablet. I picked this €189.00 Wi-Fi unit with 4 GB RAM and 128 GB storage:

Product box of Lenovo Tab M10 Plus 3rd Gen 10.6" Android tablet.

Motivation

The Tab M8 HD is on okay compact and light tablet with acceptable screen quality, but has a couple of issues that make it unsatisfactory for more than casual usage.

First, it's slow. Unbearably slow.

Every gesture or action comes with considerable lag. When the device boots up, it takes a lot of time to initialize and start all the processes before the system responds to user input. This is because of a combination of slow SoC and limited RAM, 2 GB for my Tab M8 HD. It's just not enough and the system is contantly swapping, with a major toll on latency.

Another issue is the 8” screen is not large enough to read wide, fixed layout documents and ebooks without workarounds.

I eventually got tired of the dog slow Tab M8 HD and its limitations and decided to replace it.

I wanted an affordable tablet with more RAM and noticeably better performance. In addition, I seeked a screen large enough to make A4 PDF documents, fixed layout ebooks, and programming ebooks with source code blocks comfortably readable, without adjusting the zoom or page settings of reading apps. Another important feature I was after is a software experience close to stock Android.

After overcoming some initial reservations about the weight and bulk of devices above 8”, I was eager to try a large tablet.

Reviews

My product research quickly homed in on the Tab M10 Plus 3rd Gen.

But at first something held me back, making me hesitate: the reviews were mixed, literally. Although the reviewers praised the design and finish, the great screen, and the price point, they expressed a wide spectrum of opinions over a feature I was very interested in, performance. Here are three representative reviews, from the most critical on performance (XDA Developers) to the most favorable (Android Police):

This range of opinions convinced me the performance of the Tab M10 Plus 3rd Gen was highly subjective. I deemed acceptable the risk of disappointment and went ahead with the purchase.

Hardware

I've been using the tablet for a few days and already love it. It finally comes with all I was looking for in such a device, adequate performance and screen real estate.

The design, material, and finish have a definitely premium look, especially at this price point. The screen is just gorgeous, bright enough and crisp. This is what the tablet looks like:

Lenovo Tab M10 Plus 3rd Gen 10.6" Android tablet.

Despite the size, the device feels less heavy than I expected and I can comfortably hold it for long sessions. Although I mostly use the tablet in portrait mode, the good balance and weight are making me use it more in landscape mode. The latter orientation is more natural than I thought and the large screen gives properly optimized apps enough room to take advantage of the additional area.

Performance doesn't disappoint. While the Tab M10 Plus 3rd Gen is no top of line device (why do reviewers pitch in benchmarks a budget tablet against a premium iPad, anyway?), it's way better and more responsive than the Tab M8 HD. Which is all I wanted. With the new tablet, lag is only occasional and with a short upper bound. I can finally pick up the device and use it right when the bootstrap ends.

Although most reviewers evaluate peformance by running demanding apps such as games or media editors, I actually mostly use reading apps like ebook readers, RSS feed readers, and web browsers. This may explain the subjectivity of opinions over performance.

For the kinds of apps I run, the tablet does really well. But it can handle more resource intensive processes such as 3D graphics simulations, for example the Celestia and GlobeViewer Moon astronomy apps.

Face unlock is usable, more responsive and accurate than the Tab M8 HD.

The cameras deliver barely serviceable results only with very good lighting, otherwise the slightest darkness produces a noisy mess. But the sensors are okay for the occasional video call or QR code scan.

Battery life is very good. A full charge gets me through at least three or four days of my typical usage.

Software

Lenovo delivers devices with mostly stock Android and little bloatware, which is among the reasons I went with the vendor.

The system software of the Tab M10 Plus 3rd Gen is indeed mostly stock Android 12 with a few extra apps for operating specific features, such as a notetaking app for the Lenovo Precision 2 pen or the Dolby Atmos options in the system settings. Android 13 is coming sometime in 2023.

I initially set up the home screen like this with the productivity, messaging, and astronomy apps I use most:

Home screen of Lenovo Tab M10 Plus 3rd Gen 10.6" Android tablet.

The reviews noted that, over the past few years, Lenovo dialed up the bloatware a bit. But, again, I accepted the risk. The tablet does come with some bloatware in the form of over a dozen preinstalled apps and games. But, to Lenovo's credit, all can be uninstalled, a one-time task of just a few minutes.

One more tweak is needed though. Tablet Center, a preinstalled Lenovo app that provides support and warranty information, issues occasional notifications promoting support plans. Turning off the app's notifcations removes this last annoyance.

Reading

The Tab M10 Plus 3rd Gen turned out to be perfect for the digital reading I do.

I tried several digital publications with a range of layouts and formatting. The default settings of the Google Play Books and Kindle apps are all it takes to comfortably fit A4 PDF documents and fixed layout ebooks on the screen, without zooming. The same goes with reflowable ebooks that contain wide source code blocks. Nearly all lines fit within the margins with no wrapping.

No reading settings adjustments are required, no workarounds.

The 10.6” screen of the device also helps with browsing websites and reading web content. The magic of responsive layouts nicely adapts the content and fills the large screen.

Conclusion

My experience with tablets began in 2012 with the original Nexus 7. After using other 7” and 8” tablets, the Tab M10 Plus 3rd Gen finally convinced me that, for the kind of reading-centered tasks I use these devices for, bigger is better.

The Tab M10 Plus 3rd Gen has all the features I wanted, exactly the way I wanted them. I nailed it.

#Android

Discuss... Email | Reply @amoroso@fosstodon.org

I'm writing this with a TedGen keyboard, a wireless unit with Italian layout I bought for my ASUS Chromebox 3. Here's the product which comes also with a wireless mouse:

TedGen wireless keyboard with Italian layout.

The mouse doesn't work well though as rolling the wheel causes periodic jerky movements of the pointer. I had to keep around my old Logitech M220 mouse.

The TedGen keyboard was essentially an impulse buy. I prefer short-travel chicklet keyboards and the TedGen's design caught my attention. Plus it takes up less desk space than my old Nilox Kt40W.

I've been using the keyboard for several weeks and I like it. The keys have a nice touch similar to that of laptop keyboards.

#chromeOS

Discuss... Email | Reply @amoroso@fosstodon.org

As a hobby programmer, my greatest skill gap is achieving good software design. There's very little useful literature on problem decomposition and the main way of learning design seems a byproduct of writing lots of code.

I hope discovering and reading A Philosophy of Software Design, a book by John Ousterhout of Tcl fame, will make a difference.

The book starts by defining complexity in software and explaining its effects on the evolution and growth of systems. Along with this it defines the module, a unit of system decomposition that helps reason about design issues. The remainder of the book provides some key red flags to spot complexity, and presents principles and coding practices that improve design while controlling complexity.

Although general, these principles are precise enough to be applicable and effective. The principles and the red flags gently funnel a system along a path through the design space that progressively shapes the system to reduce complexity.

The strength of A Philosophy of Software Design is the guidance it provides helps achieve good design even without highly structured processes or step by step instructions. Ousterhout acknowledges with humility the vastity of the endeavour and doesn't promise silver bullets or instant solutions.

Another thing I like is the few code samples are surprisingly short, clear, and effective at making a point. Although the code is in Java and C++, the material applies to any language.

#books #development

Discuss... Email | Reply @amoroso@fosstodon.org

I finished implementing the commands of Stringscope, the string listing tool I'm developing with Medley Interlisp.

After Sort, Reset, and Exit I wrote the code for Min Len, Find, and Get. I also added the new command Info to show in the prompt area some statistics about the strings. Coding the other commands gave me the idea and Implementing Info seemed easy, so I did it.

Now Stringscope looks like this, with the prompt area attached to the top side of the main window and the menu at the right side:

Window of the Interlisp program Stringscope with an advanced version of the command menu.

I renamed the menu item Set threshold to Min Len as the former was too wide and stood out. Min Len is more consistent with the documentation and code of Stringscope. In addition, I centered the items instead of aligning them flush left. This is the more idiomatic way most traditional Interlisp programs and system tools lay out menus.

To explain how the commands work I recorded a screencast that walks through the features and input validation of Stringscope.

I demonstrated the program by opening and interacting with two binary files, the DOCTEST.TEDIT document created with the TEdit rich text editor and the program's compiled executable STRINGSCOPE.LCOM. I also threw in some invalid data as input to show input validation in action.

After writing the code of the commands I realized Stringscope grew to support all the features I initially planned, plus a couple more I thought of along the way.

Medley Interlisp seemed overwhelming and intimidating at first but it was too much fun, so I pressed on using and studying the system. The effort paid off and now I can not only find my way around, but also create a small yet complete program with a GUI. This is a milestone to celebrate.

It's probably time to ship version 1.0 and start thinking of how to improve Stringscope and its design.

#stringscope #Interlisp #Lisp

Discuss... Email | Reply @amoroso@fosstodon.org

I completed the migration of my personal web site from Squarespace to Blot and it's now online at paoloamoroso.com.

After fleshing out the content I disconnected the domain from the old site and connected it to the new one. The content and its organization need improvement but, now that the infrastructure is in place, I can continue from there and make all the required tweaks.

Blot is a static site generator that can publish to a site a folder stored on Google Drive like in my case, on Dropbox, or a Git repository. I set the site to Blot's Magazine template which I like for its sans serif font but I'm using only pages, not blog posts.

#misc

Discuss... Email | Reply @amoroso@fosstodon.org

I'm having a lot of fun working on the commands of Stringscope, the string listing tool I'm developing with Medley Interlisp.

I implemented the Sort menu item with its subitems Ascending and Descending, as well as the Reset item. I added also the Exit item for quitting the program, a low-hanging fruit that just required calling the CLOSEW window manager function for closing the main window.

The main window of Stringscope, the command menu, and the prompt area now look like this:

Window of the Interlisp program Stringscope with an early version of the command menu.

The commands didn't require too much new code. I take it as a sign the foundation is solid, or at least not too shaky. And Interlisp's powerful menu system made things easier. But there's some code duplication I'm not satisfied with that will need refactoring.

The next commands to implement are the ones that take input from and output to the prompt area: Get, Find, and Set threshold.

#stringscope #Interlisp #Lisp

Discuss... Email | Reply @amoroso@fosstodon.org

Enter your email to subscribe to updates.