Kaappi — R7RS Scheme in Zig

4 min read Original article ↗

Kaappi mascot

R7RS Scheme, brewed in Zig

Write the lambda. Run on the metal.

A complete R7RS-small Scheme implemented in Zig. Compile to native binaries via LLVM on AArch64 and x86_64 — so the source stays elegant and the machine stays busy.

you write (map (lambda (x) (* x x)) '(1 2 3 4 5))

it returns (1 4 9 16 25)

curl -fsSL https://kaappi-lang.org/install.sh | bash

600+ procedures 178 SRFIs first-class call/cc C FFI OS threads web · databases · email · crypto

The full pour

Everything R7RS asks for, and the parts that make it fun.

Every identifier from Appendix A is implemented — then continuations, a native compiler, and an FFI on top.

conformance

Complete R7RS-small

600+ built-in procedures, 32 syntax forms, all 16 standard libraries — every identifier from Appendix A.

control

First-class continuations

Multi-shot call/cc via stack copying, plus dynamic-wind and call/ec for escapes.

speed

Compile to native code

Compile Scheme to native binaries via LLVM on AArch64 and x86_64 — closures, tail calls, and fixnum arithmetic run at full speed.

batteries

178 SRFIs

Lists, strings, hash tables, vectors, threads, formatting, char-sets — 12 built in, 162 portable.

interop

C FFI with callbacks

Call shared libraries from Scheme, and pass Scheme procedures where C expects a function pointer.

concurrency

OS threads & fibers

Real OS threads via SRFI-18, plus green fibers with channels. Pre-fork and threaded HTTP servers.

Taste it

Small forms, full language.

Run these yourself in the browser playground — no install needed.

recursion

(define (fib n)
  (if (< n 2) n
      (+ (fib (- n 1))
         (fib (- n 2)))))

(fib 30)  ;=> 832040

hygienic macros

(define-syntax my-when
  (syntax-rules ()
    ((_ test body ...)
     (if test
         (begin body ...)))))

(my-when #t
  (display "hello"))

libraries

(define-library (math)
  (export square cube)
  (import (scheme base))
  (begin
    (define (square x)
      (* x x))
    (define (cube x)
      (* x x x))))

Kaappi: A Scheme Programming Language — the paperback, seen at an angle

The slow brew

Scheme will change how you think about code.

Written for programmers who already know Python, JavaScript or Ruby and nothing about Lisp. It starts at the REPL prompt and builds one runnable example at a time, with exercises at the end of every chapter.

first edition, 2026 337 pages paperback in 9 countries

PART I

Getting Started

Install it, meet the REPL, run your first program.

3 chapters

PART II

The Language

Data types, lists, control flow, functions, bindings, higher-order functions, I/O.

7 chapters

PART III

Going Further

Macros, libraries, records, error handling, continuations.

5 chapters

PART IV

Beyond R7RS

The SRFI library, the C FFI, concurrency.

3 chapters

Watch

Learn Kaappi on video.

Short, one idea at a time, and every line of code on screen is real output from the Kaappi binary. More at @KaappiScheme.

guide/

User Guide

Installation, REPL features, the language tutorial, and the command-line reference.

Start here →

playground/

Browser Playground

Edit and run Scheme in the browser. WASM-powered, no install required.

Open →

tour/

Interactive Tour

12 guided lessons from expressions to macros, with live code and challenges.

Start →

procedures/

Procedure Reference

All 600+ built-in procedures with examples, organized by domain.

Browse →

srfi/

SRFI Support

All 178 SRFIs, the standard libraries, and how to write your own.

Browse →

ecosystem/

Ecosystem

Web framework, Redis, PostgreSQL, HTTP/HTTPS, JSON — and the thottam package manager.

Explore →

cookbook/

Cookbook

Build a REST API, serve HTML, process JSON, write tests — practical recipes for real programs.

Cook →

faq/

FAQ

Production readiness, platform support, comparisons to other Schemes, and deployment.

Read →

cheatsheet/

Cheatsheet

The language on one duplex A4 sheet — syntax, procedures, CLI, and REPL. Print it, pin it.

Print →