RSSAmplifier

Blog

weinholt.se

Gwen's funny pages

weinholt.seRSS feed ↗46 posts

Latest posts

The State of Chez Scheme in Debian

I have uploaded Chez Scheme 10.4.0 to Debian unstable. It has been a few years since there was a new Chez Scheme version in Debian, and that is all on me. 😅 The new release builds fine on all architectures according to the build logs . In case you missed it, Chez Scheme got an infusion of energy from the Racket people and gained portable bytecode support a few years ago. So for those…

Loko Scheme 0.13.0

Loko Scheme 0.13.0 is now available from: https://scheme.fail/releases/loko-0.13.0.tar.gz https://scheme.fail/releases/loko-0.13.0.tar.gz.sig A bootable disk image for 64-bit PCs is available from: https://scheme.fail/releases/disk-images/loko-hdd-0.13.0.img.gz https://scheme.fail/releases/disk-images/loko-hdd-0.13.0.img.gz.sig The signatures are made with the GnuPG key 0xDD839B748F10AD4D. Loko…

Chez Scheme 10 in Debian experimental

I have recently been working on getting Chez Scheme 10.0.0 into Debian and have uploaded it to Debian experimental . After some minor fixes it now builds on most archs except armel and x32 , using bytecode where a native port is not available. Please test it and report any bugs in the Debian bug tracker.

Fuzzing Scheme with AFL++

The comments on this blog are now back from their GDPR-induced coma. I’m using a custom comment system powered by HTMX and a backend built on Loko Scheme . While writing the backend, one thing lead to another and I wanted to see if my HTTP message parser could crash. This is when I discovered that the AFL support in Loko Scheme had suffered bit rot. I have repaired it now and wanted to demonstrate…

Akku website updates

I have had some free time recently between working for clients, and took this opportunity to implement new features for Akku’s website . In case you did not know, Akku is a package manager with features specially designed for R6RS and R7RS Scheme. The library systems in Scheme make it possible to automatically analyze source code to find libraries, exports and imports. Akku combines such analysis…

Loko Scheme 2022 Q4 Update

I released Loko Scheme 0.12.0 last month and forgot to blog about it. I’ve been busy starting my own consulting company so it just slipped my mind. There are two cool milestones with this release. Self-compilation on bare metal A cool milestone in 0.12.0 is one of those things that is pretty significant but that you can’t really demonstrate visually. I have implemented enough of the Linux syscall…

Cond-expand and #ifdef

In the C programming language you can ask the macro preprocessor to keep or remove part of a source file. This is done with #ifdef . The equivalent in Scheme is called cond-expand . R7RS Scheme has two different instances of cond-expand , while R6RS Scheme does not have it all. What does R6RS do instead, and is cond-expand a bad idea? Use cases What is #ifdef , an its cousins #if and #ifndef ,…

Valve Index in Infrared

I was visiting a friend over the new year and at one point we were playing around with his Leap Motion camera. I realized that the Valve Index uses infrared (IR) and should look cool in the camera. These images and videos were made for a lark, so they’re not studio quality. They show some interesting things that I couldn’t find elsewhere. A lot of people have both a Valve Index and a Leap Motion,…

Loko Scheme 0.9.0

Loko Scheme 0.9.0 is now available from: https://scheme.fail/releases/loko-0.9.0.tar.gz https://scheme.fail/releases/loko-0.9.0.tar.gz.sig A bootable disk image for 64-bit PCs is available from: https://scheme.fail/releases/disk-images/loko-hdd-0.9.0.img.gz https://scheme.fail/releases/disk-images/loko-hdd-0.9.0.img.gz.sig The signatures are made with the GnuPG key 0xE33E61A2E9B8C3A2. Loko Scheme…

A Record Type Representation Trick

I’ve been working on optimizations in Loko Scheme recently and have implemented large parts of A Sufficiently Smart Compiler for Procedural Records (Keep & Dybvig, 2012). At the same time I have improved the representation of record type descriptors and wanted to share a simple trick I used to improve record type checks for non-sealed records. But first I should explain what a record is in Scheme.…

Akku.scm 1.1.0 released

Akku.scm version 1.1.0, a language package manager for R6RS and R7RS Scheme, is now generally available. It can be downloaded from GitLab . This version adds support for Guile 3.0, Digamma, and includes some bug fixes and new features. Akku is a language package manager designed for Scheme. In Scheme, libraries can be analyzed to find their names, exports and imports. Akku uses this information,…

Non-POSIX file systems

Operating systems and file systems have traditionally been developed hand in hand. They impose mutual constraints on each other. Today we have two major leaders in file system semantics: Windows and POSIX. They are very close to each other when compared to the full set of possibilities. Interesting things happened before POSIX monopolized file system semantics. When you use a file system through a…

Loko Scheme 0.6.0

Loko Scheme 0.6.0 is now available from: https://scheme.fail/releases/loko-0.6.0.tar.gz https://scheme.fail/releases/loko-0.6.0.tar.gz.sig The release tarball is signed by the GnuPG key 0xE33E61A2E9B8C3A2. Loko Scheme 0.6.0 introduces support for R7RS-small. The release tarballs now include a pre-built compiler and all dependencies needed for building Loko. See NEWS.md in the distribution for a…

Akku Archive Improvements

Akku.scm is a language package manager for R6RS and R7RS Scheme. The software that powers the package index has been growing beyond the simple one-liner it was in the beginning and today I’ve finally pushed it to a public repository. I’ve also made preparations for hosting packages as tarballs directly in the archive. Tarballs The Akku archive has never hosted packages directly. The index points…

Real Internet on an RTOS

I recently wrote an article on my company’s blog. The gist of it is that we now have the technology to get real internetworking (that’s a word) on embedded devices. If you’re making a connected device that runs an RTOS then you should have a look: Real Internet on an RTOS .

Quasiquote - Literal Magic

While I was writing a manpage for Scheme’s quasiquote , something I saw surprised me and changed my understanding of quasiquote. It turns out that a new language, with semantics that are interesting to PLT enthusiasts, hides behind the innocent backtick character. Starting with R6RS Scheme, quasiquote became total magic . Background It is not going to be easy to understand the argument in this…

Device Drivers in Loko Scheme

Loko Scheme is an R6RS Scheme compiler that runs on Linux and bare metal. To be useful on bare metal it needs device drivers. One of the more interesting device drivers is the virtio net driver, which paves the way for more virtio drivers. This is going to be a long one Before explaining what virtio is, I will briefly go through how device drivers work in Loko. This is followed by descriptions of…

Loko Scheme 0.4.3

Loko Scheme 0.4.3 is now out with a few important fixes, new features and network card drivers for eepro100, rtl8139, virtio net and Linux tuntap devices. The include form is now available and #u8() is recognized. Hashtables are written using Racket’s #hasheq() syntax, and cycles are handled while printing records. Read more about the drivers in the companion article Device Drivers in Loko Scheme…

Booting a Video BIOS

Graphics. Video! How do you get even basic graphics running on a PC? One way is to use the expansion ROM on the graphics card. Loko Scheme 0.3.4 is out now and comes with a rudimentary VBE driver that uses this method. Video BIOS & VESA SuperVGA BIOS The original IBM PC line of computers had support for switchable graphics cards. It originally came with CGA and MCGA, but there were quickly…

A New R6RS Scheme Compiler

Some readers already know this and a few have suspected. I’ve been working on a new R6RS Scheme compiler for a while. Now I have released it as free software. Read on to learn the many wonderful drawbacks of this niche compiler. I will start with what many will find to be the largest drawback, so that those of you who don’t want it can close this tab right away and never look back (but don’t close…

On recent events

This has come down from old, Atula, & not just from today: they find fault with one who sits silent, they find fault with one who speaks a great deal, they find fault with one who measures his words. There’s no one unfaulted in the world. There never was, will be, nor at present is found anyone entirely faulted or entirely praised. – The Buddha ( Dhammapada XVII : Anger )

Announcing Akku.scm 1.0.0

I am happy to announce the general availability of Akku.scm 1.0.0, a language package manager for R6RS and R7RS Scheme. It can be downloaded from GitLab and GitHub . Akku is a package manager with features specially designed for Scheme. The library systems of R6RS and R7RS, where libraries are fully self describing, make it possible to automatically analyze source code to find libraries and…

Terminfo and its DSL

Programs for Linux that run in the terminal often use color. There are a few approaches to making this work. Many programs use hardcoded ANSI compatible escape sequences, which are widespread enough today that they work almost everywhere. There are drawbacks to hardcoding these and for that reason there’s a database called terminfo , which has its own stack-based Domain Specific Language (DSL).…

Alignment Checking & Meltdown

Here is some interesting news for compiler writers worried about Meltdown. I have previously described a way to get hardware-based type checks (think branchless car , cdr , vector-ref , etc.) using alignment checks . It now appears that this technique may be immune to Meltdown-type attacks: Alignment Faults. Upon detecting an unaligned memory operand, the processor can (optionally) generate an…

Design Your Low-Bit Tagging with Z3Py

Low-bit tagging is a technique where the low bits of values are used to store type information. There are numerous benefits that come with this technique and it is quite popular in implementations of Scheme, JavaScript and other languages. But once you start down the road of bit-twiddling it is hard to stop and the design of the tagging system may become difficult to understand. So that’s when you…

R7RS versus R6RS

InPhase asked today on #scheme about the R7RS vs R6RS debate. I followed the original debate closely and have experience both using and implementing R6RS. I also recently added R7RS support in Akku.scm 0.3.0, so I feel like I can weigh in on this. It’s a topic that many feel passionately about, and I’m also firmly on one side of the debate, but I will try to keep my own opinions and hyperbole out…

R7RS comes to Akku

I have made some strides with Akku.scm since the introductory blog article and the announcement on the Chez Scheme mailing list. The big feature on the horizon is support for translating R7RS libraries to run on R6RS. But first of all I need to apologize for building version 0.2.3 with libncurses6. Chez Scheme uses ncurses for its expression editor and Debian sid, which I use, has just had a…

Columns Game for Arduino

I previously wrote about an AI for the Columns game . It was actually not written for the web to start with, but for a set of NeoPixel displays. Now I have fixed it up a little, made the code public and even have a picture to show. The hardware for this build is a NodeMCU board (ESP8266 based) hooked up to two CJMCU-64 RGB LED displays in cascade. The displays are very easy to connect. After…

So many package managers

In a previous article , I wrote about Akku.scm , a package manager for Scheme. It is far from being the first package manager or even the first for Scheme. There have been at least a dozen failed attempts at getting something going. Dorodango is another package manager aimed at R6RS. It works more like a system package manager (apt, dpkg) in some sense. You point it at a repository and it can then…

Introduction to Akku.scm

For the past few months I’ve been working on Akku.scm , a language package manager for R6RS Scheme. It’s not the first one for Scheme and it’s not even the first for R6RS. But it’s here, it’s yet another package manager, it works and I’m using it. Language package managers are specialized to some specific set of programming languages. They are not general tools to distribute any kind of software.…

Turn Websites into APIs

There are times in a programmer’s life when he needs an API to an intranet service and the only existing interface is a website built in the 90s. It feels wrong and a little dirty. But it may be the only option. It will save the business. Against better judgment, you decide to try web scraping their site. So you connect a socket to their web server and send a GET request. The response contains…

Improvised Remote Control

One negative thing about Sweden is that one is not allowed to have a TV receiver (of any kind, and especially not broken one) without paying a special fee of around €245 per year [ This is no longer optional as of 2019 and is now a type of tax instead ]. An alternative that enables playing couch co-op in the living room is to get a projector or large display that lacks a TV tuner/decoder. We…

Linting Scheme with r6lint

I find it useful while working in Python, JavaScript or C to have Emacs show me the location of code errors. For Python there is Pylint and for JavaScript one can use JSHint and a few others. And of course with C there was the original lint , but today the compilers themselves generate quite good warnings. These linters are easily integrated with Emacs via Flycheck , which highlights errors in the…

Structure of the ARM A64 instruction set

Earlier this year I bought a Raspberry Pi 3 to have as an AArch64 development machine. The fastest way to get familiar with an instruction set is to write a disassembler for it and I’ve made one for 64-bit ARM in R6RS Scheme as part of the machine-code project. The instruction set is called ARM A64, instructions are always 32 bits wide and they have a neat structure which is pretty fast to decode…

Splitting Industria

Recently a friend lent me the book Start With Why by Simon Sinek. It made a lot of sense to me and made me look at my own projects in a new light. The Industria libraries is a set of libraries for R6RS Scheme that do, well, quite a few different things. There’s cryptography, compression, a few network protocols, various things, but also an assembler and a few disassemblers. It has many things, but…

Automated Testing of Zabavno

I had already been programming for twenty years before I started my current project at Ericsson. During my time in the project I’ve come to really appreciate a few things that were new to me, like Continuous Integration (CI) and automated testing. I recently setup CI for Zabavno on GitHub with a new test case generator and immediately found bugs. The approach Zabavno is an x86 emulator and the x86…

AI for the Columns Game

In the early part of the 1990’s there was a Windows game that I was playing on my father’s computer. I remember it quite fondly and recently found it in the Internet Archive. The game was Jewel Master by Peter Siamidis and it can be played online . I didn’t know it at the time, but it’s apparently a clone of a Sega game called Columns . Go figure. Even though I enjoyed it quite a lot I wasn’t…

Make Test Inputs with Prolog

A while back I wrote a parser for R6RS Scheme numbers, or the string->number procedure. Numbers in Scheme are somewhat sophisticated and can be written in some surprising variations and I wanted some test inputs for verifying that the parser doesn’t crash on valid inputs. Luckily, the number syntax is specified in such a way that a Prolog program easily can be written that generates test inputs.…

Debugging PC Boot Sectors

Recently while working on Zabavno the emulation was going wrong somewhere in a boot sector and I needed to check what it was actually supposed to be doing. This is pretty easy to do with QEMU as a remote target in gdb, but it can be tricky to get started. In gdb there is support for something called remote debugging, which uses a simple protocol that allows gdb to inspect the state of the target…

AI Solver for Coded Crosswords

A certain type of crossword has been catching my attention ever since I was little. But it never interested me much to sit down and solve it on paper. What I wanted to do was to write a program that helps me solve it or, even better, one that finds the solution itself. Twenty years ago, very early in 1997, I wrote a Pascal program for DOS that set a high resolution text mode (132x60!) and drew the…

Compact Encoding of Routing Prefixes

How many bits of information are contained in a routing prefix? When printed, a routing prefix commonly looks like an IP address followed by a slash and then a prefix length : 192.0.2.0/24 or 2001:db8::/32. That should mean a minimum of 32 + ceiling ( log 2 (32 + 1)) = 38 bits for an IPv4 prefix and 128 + ceiling ( log 2 (128 + 1)) = 136 bits for IPv6. However, it is possible to encode a prefix in…

Efficient computation of the "man or boy" test

Here’s a quote from a computer scientist living in what was clearly simpler times: […]. Hence I have written the following simple routine, which may separate the man-compilers from the boy-compilers: […] – Donald Knuth Here is Knuth’s program in ALGOL 60 : begin real procedure A(k, x1, x2, x3, x4, x5); value k; integer k; begin real procedure B; begin k := k - 1; B := A := A(k, B, x1, x2, x3, x4)…

Internals of Zabavno the x86 emulator

Zabavno (Забавно) is an x86 emulator I’ve been working on in my spare time. It translates x86 instructions into Scheme and eval’s them, which works surprisingly well. The initial commit was made two years ago, but at the time I only worked on it for a few weeks. When Chez Scheme was open sourced I got interested in it again, since the techniques used depend on having a good compiler. (And Chez…

Shiny new website layout

This website has a new layout. The previous anti-social directory listing layout is gone and the future is shiny. I’ve been putting this off for maybe ten years now. I still wanted a static web site because it’s so much easier to run a web server that way. So I went looking for a Node.js based static site generator. Node.js because, honestly, JavaScript is the language for the web. There are a few…

Supercompiling Erlang

Supercompiling Erlang is my Master of Science thesis. Here is the abstract: Erlang is a programming language with excellent support for parallel and distributed programming. The functional programming paradigm with its higher order functions is used pervasively in Erlang, but code written in this style suffers in performance. In this work a supercompiler for Erlang is presented that can…

Faster Dynamic Type Checks

“Arranging for Safety Checks with Hardware Traps” was the title of an article I wrote for a class project. It describes how to use the Alignment Checking feature of the x86/AMD64 architecture to get branchless dynamic type checks. The article has not been published formally, although it was written in a style that makes it look like it could be published. I was unable to find anything in the…