Reading
[ Modified: 2024 Apr 22 ]

Some notes from reading some documentation. Maybe this will help me keep up with whatever my curiosities happen to be about these topics.

Guile
[excerpt]

Guile is designed to help programmers create flexible applications that can be extended by users or other programmers with plug-ins, modules, or scripts. With Guile you can create applications and games for the desktop, the Web, the command-line, and more.

Main interest in this is that Guile is an implementation of Scheme (a Lisp dialect). Would like to shift to a different Lisp than Common Lisp (another dialect of Lisp).

GUIX
[excerpt]
  • Liberating. Guix is a distribution of the GNU operating system developed by the GNU Project—which respects the freedom of computer users.

  • Dependable. Guix supports transactional upgrades and roll-backs, unprivileged package management, and more. When used as a standalone distribution, Guix supports declarative system configuration for transparent and reproducible operating systems.

  • Hackable. It provides Guile Scheme APIs, including high-level embedded domain-specific languages (EDSLs) to define packages and whole-system configurations.

I absolutely abhor package management because I absolutely abhor shared libraries (or frameworks) of computer instructions, especially precompiled. Security is impossible, resources are wasted, and ignorance is promoted by insisting on trusting complete strangers (no communication). There is no personalization possbile when the technology is unapproachable.

However, GUIX provides a Lisp interface for such management, by means of Guile. It can even manage setting up the whole operating system. Pretty sure it is still without access to the kernel (Linux). Otherwise, the same horrifying experience from unweildy computer programs packaged for promotion of technological ignorance.

Would likely minimize use of GUIX, such as by using the piCore setup I have minimized from TinyCore (also forum.tinycorelinux.net: Raspberry Pi). I have modified a copy of the piCore release (12.x? maybe 13.x?) to load (and stay in RAM; no need to keep SD card in slot) without the TinyCore scripts, then I use the scripts for installing software as I need it per session.

GUIX hints at being able to package a whole system, so that is attractive. Shifting to a Lisp interface for package management would mean ditching piCore completely. Nothing wrong with piCore, it was great for learning how to minimize the operating system. Just prefer Lisp rather than Ash (shell scripting), and it would be a way to become familiar with a Scheme dialect of Lisp.

"Recursive functions of symbolic expressions and their computation by machine"
John McCarthy; April 1960
[excerpt]

In this article, we first describe a formalism for defining functions recursively. We believe this formalism has advantages both as a programming language and as a vehicle for developing a theory of computation. Next, we describe S-expressions and S-functions, give some examples, and then describe the universal S-function apply which plays the theoretical role of a universal Turing machine and the practical role of an interpreter.

Then we describe the representation of S-expressions in the memory of the IBM 704 by list structures similar to those used by Newell, Shaw and Simon [2], and the representation of S-functions by program. Then we mention the main features of the LISP programming system for the IBM 704. Next comes another way of describing computations with symbolic expressions, and finally we give a recursive function interpretation of flow charts.

Seems like LISP started as just a notation for mathematical formulas, or maybe for axioms. Someone tried to implement it on a computer, and then the initial means for memory management was developed. That might be why lists are pairs in Lisp (Lisp lists are pairs), being influenced by the circuitry of that particular computer.

Overall, Lisp is a very small set of keywords, though modern implementations have hundreds more keywards for the sake of conveniences, t.i. "just in case it might be useful".

Bel, a new dialect of Lisp
[excerpt]

Bel is a spec for a new dialect of Lisp, written in itself. This should sound familiar to people who know about Lisp's origins, because it's the way Lisp began.

...

uLisp
[excerpt]

Lisp for microcontrollers

Lisp for Arduino, Adafruit M0/M4, Micro:bit, ESP8266/32, RISC-V, and Teensy 4.x boards.

uLisp® is a version of the Lisp programming language specifically designed to run on microcontrollers with a limited amount of RAM, from the Arduino Uno based on the ATmega328 up to the Teensy 4.0/4.1. You can use exactly the same uLisp program, irrespective of the platform. For the performance of each platform see Performance.

Because uLisp is an interpreter you can type commands in, and see the effect immediately, without having to compile and upload your program. This makes it an ideal environment for learning to program, or for setting up simple electronic devices.

Lisp is also an ideal language for learning about fundamental programming concepts. It incorporates string handling, list processing, and garbage collection, and so is also an excellent language for expressing complex ideas, such as teaching a robot to solve mazes or finding the shortest route on a map. As well as supporting a core set of Lisp functions uLisp includes Arduino extensions, making it ideal as a control language for the Arduino.

Seems to get installed directly on the microcontroller. So far, have only gone as small as a Raspberry Pi 4, which is unlikely to be accepted as a microcontroller. I think I could probably get by with much less, and was considering one of the earlier Raspberry Pi models (RPi 3, or maybe even RPi 1). Have also been considering exploring microcontrollers.

There is the Raspberry Pi Pico, which has their microcontroller known as RP2040. Other manufacturers have used that RP2040 to make their own microcontrollers, too, f.e. Adafruit, Sparkfun, Seeed Studio, and Pimoroni. The uLisp website has info for installing it on such RP2040 boards (uLisp.com: RP2040 boards).

The Kernel programming language
[excerpt]

Kernel is a conservative, Scheme-like dialect of Lisp in which everything is a first-class object.

"Revised-1 Report on the Kernel Programming Language" (revised 29 October 2009)
John N. Shutt; 2004-2012, 2015-2021

[excerpt]

Kernel is a statically scoped and properly tail-recursive dialect of Lisp, descended from Scheme. It is designed to be simpler and more general than Scheme, with an exceptionally clear, simple, and versatile semantics, only one way to form compound expressions, and no inessential restrictions on the power of that one compound form. Imperative, functional, and message-passing programming styles (to name a few) may be conveniently expressed in Kernel.

All manipulable entities in Kernel are first-class objects. The primary means of computation are operatives, which are statically scoped combiners that act on their unevaluated operands; operatives subsume the roles handled in most modern Lisps by special forms and macros. Applicatives are combiners that act on their evaluated arguments, hence are roughly equivalent to Scheme procedures; but an applicative is merely a facilitator to computation, inducing evaluation of operands for an underlying operative.

...

Scheme without special forms: a metacircular adventure
[excerpt]
...

As an example, the Scheme programming language is explicitly based on the lambda calculus. But it adds syntactic special forms for definitions, variable binding, conditionals, etc. Scheme also lets the programmer define new syntactic forms as macros translating to existing syntax. Indeed, lambda and the macro system are enough to implement some of the standard special forms.

But we can do better. There's a simple abstraction which lets us define lambda, Lisp or Scheme macros, and all the other special forms as mere library code. This idea was known as "fexprs" in old Lisps, and more recently as "operatives" in John Shutt's programming language Kernel. Shutt's PhD thesis [PDF] has been a vital resource for learning about this stuff; I'm slowly making my way through its 416 pages.

...

This is the hallmark of (meta)programming with operatives: we selectively evaluate using eval, rather than selectively suppressing evaluation using quote.

...

So we have lexical scoping by default, with the option of dynamic scoping thanks to that env parameter.

Compare this situation with Lisp or Scheme macros. Lisp macros build code which refers to external stuff by name. Maintaining macro hygiene requires constant attention by the programmer. Scheme's macros are hygienic by default, but the macro system is far more complex. Rather than writing ordinary functions, we have to use one of several special-purpose sublanguages. Operatives provide the safety of Scheme macros, but (like Lisp macros) they use only the core computational features of the language.

...

...

Common Lisp HyperSpec

Useful for StumpWM, because it uses SBCL, an implementation of Common Lisp.

USB 2.0 specification

Would like to eventually connect a computer to another computer. The first computer would be personalized for custom peripherals, f.e. a computer buttonboard and/or a motion remote control. It would also be able to simulate a peripheral.

Either way, the second computer would recgnize the first computer as a peripheral for input (f.e. computer buttonboard or motion remote) or output (f.e. printer or monitor), or as a USB hub for the potential of multiple peripherals. Ideally, a Lisp interface for managing the USB connection from the first computer.


sharing