2026-11-26 15:49 UTC

Digamma offers Scheme runtime with async Google AI integrations

state: seedheat: lowuncertainty: mediumrelevance: mediumai-workflows programming-languages developer-toolsDigamma maintainer

What is this?

Digamma is an open-source Scheme dialect maintained by GitHub user fujita-y, presented in its repository as a language for AI workflow automation. The repository describes an LLVM ORC JIT, a self-hosted compiler, cooperative fibers and asynchronous I/O, plus built-in Vertex AI (Gemini) and Dialogflow CX calls. It provides build instructions and Docker image tags, suggesting it is available to try; the supplied material does not establish production adoption or independent evaluation. A Hacker News post linked the project on 18 November 2026. The repository reports preliminary Raspberry Pi 5 benchmark results, but those are project-provided and limited to a partial suite.

Why it matters

This is a small developer-tool release, not a new AI model. Its interesting idea is to make concurrent cloud-AI calls and workflow logic part of a programmable Scheme runtime, potentially useful for developers who value Lisp’s extensibility and want to build responsive services without managing each inference call as a blocking operation. The LLVM/JIT and runtime claims are technically ambitious, but evidence of real-world use, reliability, or an advantage over established languages and frameworks is not supplied.

Current assessment

The project repository is the primary evidence: it documents a usable Scheme implementation called Digamma, with the nanos VM, on-demand LLVM ORC compilation, fiber-based asynchronous I/O, a C FFI, and native Vertex AI/Gemini and Dialogflow CX primitives. The README gives installation/build instructions and Docker tags for x86_64 and ARM64, and says cloud calls can return futures so other fibers continue while inference is in flight. These are project-described capabilities, not independently verified performance or adoption findings. The README says the default Gemini model is gemini-2.5-flash and lists Google Cloud project/location configuration requirements. It also cautions that Digamma does not target full RnRS conformance. Its partial Raspberry Pi 5 benchmark claims the fastest wall-clock result in 25 of 30 tests versus Ypsilon and Guile; treat this as preliminary, author-reported evidence, not a general performance conclusion. The supplied web results corroborate the GitHub project and Docker listing but add no independent technical assessment. Significance is mainly the possibility of a compact, extensible language environment for orchestrating concurrent AI and Dialogflow calls; the practical impact remains uncertain without user uptake, external testing, or comparative workflow evidence.

Measured heat

now 0 pts/hpeak 2 pts/hcomments 0/hpeers p10momentum: steady2 platformsage 214h
points/hour across evidence Β· reading as of 2026-11-27 02:23:58.509736+11:00 Β· deterministic, not a model opinion

How the heat travelled

11-17 18:26 (minted)⭐ origin echo-reconstructedThe HN post links directly to the project’s original repository, with no upstream article, paper, or social post cited. The README describes
Yoshikatsu Fujita (@fujita-y) on github (echo) Β· attributed from hn.story.50535147 Β· published time unknown
β€”
11-17 17:41first on hacker news Β· published Β· lag ?Digamma: A lightweight, JIT compiled Scheme for AI workflows
packetlost
β€”
11-17 17:41amplified on hacker news πŸ‘‘hn.story.50535147
packetlost
peak 1 Β· 0 comments Β· 103% of case engagement
11-17 18:20our radar first saw it Β· lag ?discovery anchor: hn.story.50535147β€”
pace: p13 vs 2096 stories at the 168h mark (now 214h old) β€” behind adobe-max-ai-agents-creative-tools-mcp (0.5x)

Evidence (2) β€” ⭐ canonical anchor

sourceobjectauthorscorecomments
🟧 hnDigamma: A lightweight, JIT compiled Scheme for AI workflows
Retrieved article excerpt

Open article Β· Retrieved 2026-11-17T18:22:23.057080+00:00

# Digamma

Digamma is a lightweight Scheme dialect designed for AI workflow automation.
It focuses on execution efficiency and Lisp-based extensibility rather than strict RnRS compliance.
Users seeking a complete R6RS/R7RS implementation should see [Ypsilon](https://github.com/fujita-y/ypsilon), developed by the same author.

Digamma features a self-hosted compiler, an LLVM-based JIT backend, a concurrent garbage collector, and a tagged-pointer object system with ARM64 TBI support.
Its virtual machine, **nanos**, compiles Scheme to native code on-demand through a multi-stage pipeline.

While Digamma does not target full RnRS conformance, it provides standard hygienic macros β€” `syntax-case` and `syntax-rules` β€” for expressive, composable abstractions.

### Highlights

| Category | Description |
| --- | --- |
| **Runtime** | Fiber-based concurrency with integrated async I/O and networking |
| **AI** | Native Vertex AI (Gemini) and Dialogflow CX integration via asio-grpc |
| **Compiler** | Self-hosted Scheme compiler with LLVM ORC JIT backend |
| **GC** | Mostly-concurrent mark-sweep collector on a dedicated thread |
| **FFI** | Dynamic C foreign function interface backed by LLVM ORC |
| **Pointers** | ARM64 TBI tagged-pointer object system with zero-cost tag access |



---

## Features

### Fiber-Based Concurrency, Networking, and Asynchronous I/O

Digamma implements lightweight, cooperative multitasking using **fibers** backed by `boost::fibers`.
The fiber scheduler is wired directly into Boost.Asio's `io_context`, so I/O completion handlers run inline without spawning OS threads.

```
(let* ((f1 (fiber (lambda ()
                    (display "Fiber 1 starting\n")
                    (fiber-sleep-for 100)
                    (display "Fiber 1 done\n")
                    42)))
       (f2 (fiber (lambda ()
                    (display "Fiber 2 starting\n")
                    (fiber-yield)
                    (display "Fiber 2 done\n")
                    'done))))
  (display (list (future-get f1) (future-get f2)))
  (newline))
```

**Fiber primitives**


| Primitive | Description |
| --- | --- |
| `(fiber <thunk>)` | Spawn a fiber; returns a future |
| `(fiber-yield)` | Cooperatively yield to the scheduler |
| `(fiber-sleep-for <msec>)` | Suspend without blocking the scheduler |
| `(future-get <future>)` | Block until the future resolves and return its value |
| `(future-wait <future>)` | Block until the future resolves |
| `(future-wait-for <future> <msec>)` | Block with a timeout |
| `(future? <obj>)` | Future type predicate |


**Async networking primitives** (fiber-aware, non-blocking)


| Primitive | Description |
| --- | --- |
| `(get-bytevector-n-async <port> <n>)` | Non-blocking port read; returns a future |
| `(https-get <url> <port>)` | HTTPS GET; suspends the current fiber |
| `(https-get-async <url> <port>)` | Non-blocking HTTPS GET; returns a future |



---

### Async grpc - Google Cloud AI Integration

Digamma provides **built-in, non-blocking access to Vertex AI (Gemini) and Dialogflow CX** directly from Scheme.
Unlike typical FFI wrappers that stall the interpreter, every AI call is dispatched through the fiber scheduler using `asio-grpc`, so other fibers keep running while cloud inference is in flight.

#### Vertex AI / Gemini

```
;; Synchronous β€” blocks the current fiber, not the scheduler
(generate-content "Explain monads in one sentence.")

;; Asynchronous β€” returns a future immediately
(let ((f (generate-content-async "Write a haiku about Scheme.")))
  (display "Doing other work while waiting...\n")
  (display (future-get f))
  (newline))
```

**Vertex AI primitives**


| Primitive | Description |
| --- | --- |
| `(generate-content prompt [model] [location] [project-id])` | Synchronous inference |
| `(generate-content-async prompt [model] [location] [project-id])` | Non-blocking; returns a future |

Default model: `gemini-2.5-flash`.

#### Dialogflow CX

```
;; Dispatch two intents concurrently
(let* ((f1 (dialogflow-cx-detect-intent-async "Book a flight" "my-agent-id"))
       (f2 (dialogflow-cx-detect-intent-async "Cancel order" "my-agent-id")))
  (display (future-get f1)) (newline)
  (display (future-get f2)) (newline))
```

**Dialogflow CX primitives**


| Primitive | Description |
| --- | --- |
| `(dialogflow-cx-detect-intent text agent-id [session-id] [location] [project-id] [language-code])` | Synchronous intent detection |
| `(dialogflow-cx-detect-intent-async text agent-id [session-id] [location] [project-id] [language-code])` | Non-blocking; returns a future |

Session IDs are auto-generated (UUID) if omitted.

Note

Both APIs require the `GOOGLE_CLOUD_PROJECT` environment variable (or an explicit argument).
`GOOGLE_CLOUD_LOCATION` defaults to `us-central1`.

---

### LLVM JIT Compilation

Nanos uses **LLVM ORC** (JITLink + CompileOnDemand) to compile each Scheme expression to native machine code on the fly.
The pipeline runs entirely in-process with no ahead-of-time batch step:

```
Source β†’ Macro Expand β†’ Optimize β†’ Lambda Lift β†’ Closure Conversion β†’ LLVM IR β†’ Native Code
```

Key code-generation optimizations:

- **Escape and stack-allocation analysis** β€” elides heap allocation and write barriers for short-lived closures.
- **Inlined primitives** β€” common arithmetic, predicate, and list operations emitted as inline LLVM IR.
- **Tail-call optimization** β€” proper tail calls via LLVM `musttail`.

---

### ARM64 Tagged Pointers (TBI)

On ARM64, Digamma exploits the hardware **Top Byte Ignore** feature to store type tags in the high byte of every pointer.
In release builds, tagged pointers can be dereferenced directly β€” no masking needed, zero runtime cost for tag removal.

| Type | Tag Encoding |
| --- | --- |
| Fixnum (63-bit) | `.....1` |
| Cons (pair) | `...000` |
| Heap object | `...010` + type code in high byte |
| Short flonum (61-bit) | `...100` |

Heap objects use a 6-bit type code (`tc6`) supporting symbols, strings, vectors, closures, fibers, ports, hashtables, cells, and more.

---

### Concurrent Garbage Collector

The GC is a **mostly-concurrent, mark-sweep collector** running on a dedicated thread:

- **Slab allocator** β€” fixed-size object pools with per-slab bitmaps for fast allocation and sweep.
- **Tri-color marking** β€” concurrent marking with write barriers and a shade queue for mutator cooperation.
- **Multi-phase STW** β€” multiple short stop-the-world pauses (root snapshot β†’ concurrent mark x N β†’ final mark) minimize mutator pause times.
- **Safepoints** β€” the compiler inserts cooperative safepoints; fiber stacks are included in the root set.

---

### C Foreign Function Interface

The `(core cffi)` module provides a dynamic C FFI backed by LLVM ORC:

**FFI primitives**


| Primitive | Description |
| --- | --- |
| `load-shared-object` / `lookup-shared-object` | Load dynamic libraries and resolve C symbols |
| `c-function` | Bind Scheme procedures to C functions with typed signatures (`int`, `double`, `void*`, `size_t`, …) |
| `c-callback` | Create native C function pointers that invoke Scheme closures |



---

### Self-Hosted Compiler and Hygienic Macros

The entire compiler pipeline is written in Scheme and cross-compiled into a boot image (`boot/core.ir`):

1. **Macro expansion** β€” full R6RS `syntax-case` and R7RS `syntax-rules` with hygienic renaming, `let-syntax`, `letrec-syntax`, and module-level macro export/import.
2. **Optimization** β€” constant folding, dead code elimination, beta reduction, let-floating, lambda dropping, inlining, unused parameter removal, pure primitive substitution.
3. **Lambda lifting** β€” promotes closed-over lambdas to top-level definitions where possible.
4. **Compilation** β€” register-based IR with closure conversion, free variable analysis, selective cell boxing for mutated/forward-referenced variables.

---

## Benchmarks

Preliminary results from a partial [Gambit benchmark suite on Raspberry Pi 5](https://fujita-y.github.io/benchmarks/benchmark_baseline.html) compare **Nanos** against **Ypsilon 2.0.9** and **Guile 3.0.10**.
Each result is a trimmed average of 7 runs (min/max excluded) reporting wall-clock and CPU time.
Nanos records the fastest wall-clock time in **25 of 30 benchmarks**.

---

## Getting Started

[llvm22 arm64](https://github.com/fujita-y/digamma/actions/workflows/ci-llvm22-arm64.yml)
[llvm22 macos](https://github.com/fujita-y/digamma/actions/workflows/ci-llvm22-macos.yml)
[llvm21 amd64](https://github.com/fujita-y/digamma/actions/workflows/ci-llvm21-amd64.yml)
[llvm21 arm64](https://github.com/fujita-y/digamma/actions/workflows/ci-llvm21-arm64.yml)
[llvm21 macos](https://github.com/fujita-y/digamma/actions/workflows/ci-llvm21-macos.yml)
[docker](https://github.com/fujita-y/digamma/actions/workflows/docker.yml)

### Requirements

| Dependency | Notes |
| --- | --- |
| **LLVM 21+** | JIT backend |
| **CMake 3.13.4+** | Build system |
| **Boost 1.88+** | `fiber`, `asio`, `beast` |
| **OpenSSL** | TLS support for HTTPS networking |
| **vcpkg** | Recommended for dependency management |
| **replxx** | Interactive REPL |
| **CLI11** | Command-line argument parsing |
| **google-cloud-cpp** | `aiplatform` and `dialogflow_cx` features |
| **asio-grpc** | Asynchronous gRPC on Asio event loops |

### Building

```
mkdir build && cd build
cmake ..
make -j$(nproc)
```

### Docker

A pre-built Docker image is available on [Docker Hub](https://hub.docker.com/r/fujitay/digamma):

```
# x86_64
docker run --rm -it fujitay/digamma:latest-amd64-llvm21

# ARM64
docker run --rm -it fujitay/digamma:latest-arm64-llvm22
```

### Rebuilding the Boot Image

The compiler pipeline is self-hosted: the Scheme files in `core/` are cross-compiled by an external RnRS Scheme (such as Ypsilon or Gauche) into `boot/core.ir`, which nanos loads at startup.
To regenerate the boot image after modifying core files:

```
rm boot/core.ir
ypsilon boot/build-core-ir.scm   # or: gosh boot/build-core-ir.scm
```

### Usage

```
./build/nanos --boot boot/core.ir                    # Interactive REPL
./build/nanos --boot boot/core.ir --script foo.scm   # Run a script
```

Run `./nanos --help` for a full list of command-line options.

---

## Testing

```
cd build && ctest                    # C++ unit tests
cd .. && tests/run_tests.sh          # Scheme integration tests
cd core/tests && ./run_tests.sh      # Core compiler tests
```

**Test suite details**

**C++ unit tests** (`tests/`) β€” five executables:

| Executable | Coverage |
| --- | --- |
| `test_core` | Object model and GC |
| `test_io` | Port and I/O primitives |
| `test_compiler` | Code-generation pipeline |
| `test_runtime` | Evaluator and runtime behaviour |
| `test_eval` | End-to-end evaluation |

**Scheme integration tests** (`tests/`):

| Suite | Coverage |
| --- | --- |
| `test_modules.scm` | Module system |
| `test_syntax.scm` | Macro and syntax forms |
| `test_system.scm` | System/environment primitives |

**Core compiler tests** (`core/tests/`):

| Suite | Coverage |
| --- | --- |
| `test_macroexpand.scm` | Macro expansion |
| `test_syntax.scm` | syntax-rules / syntax-case semantics |
| `test_compiler.scm` | Compiler output |
| `test_core.scm` | Core language forms |



---

## License

BSD 2-Clause. See [LICENSE](https://github.com/fujita-y/digamma/blob/master/LICENSE) for details.
packetlost10
🟧 echo.github ⭐The HN post links directly to the project’s original repository, with no upstream article, paper, or social post cited. The README describesYoshikatsu Fujita (@fujita-y)β€”β€”

Interpretation history

Decision trace