home / skills / plurigrid / asi / guile

guile skill

/skills/guile

This skill helps you explore and run Guile Scheme concepts, evaluate expressions, and manage modules within a Python-driven workflow.

npx playbooks add skill plurigrid/asi --skill guile

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
1.7 KB
---
name: guile
description: GNU Scheme interpreter (67K lines info).
version: 1.0.0
---


# guile

GNU Scheme interpreter (67K lines info).

```bash
guile [options] [script [args]]

-L <dir>    Add load path
-l <file>   Load source
-e <func>   Apply function
-c <expr>   Evaluate expression
-s <script> Execute script
```

## REPL

```scheme
(define (factorial n)
  (if (<= n 1) 1 (* n (factorial (- n 1)))))

(use-modules (ice-9 match))
(match '(1 2 3) ((a b c) (+ a b c)))
```

## Modules

```scheme
(use-modules (srfi srfi-1))   ; List library
(use-modules (ice-9 receive)) ; Multiple values
(use-modules (ice-9 format))  ; Formatted output
```



## Scientific Skill Interleaving

This skill connects to the K-Dense-AI/claude-scientific-skills ecosystem:

### Graph Theory
- **networkx** [○] via bicomodule
  - Universal graph hub

### Bibliography References

- `general`: 734 citations in bib.duckdb



## SDF Interleaving

This skill connects to **Software Design for Flexibility** (Hanson & Sussman, 2021):

### Primary Chapter: 5. Evaluation

**Concepts**: eval, apply, interpreter, environment

### GF(3) Balanced Triad

```
guile (−) + SDF.Ch5 (−) + [balancer] (−) = 0
```

**Skill Trit**: -1 (MINUS - verification)

### Secondary Chapters

- Ch4: Pattern Matching

### Connection Pattern

Evaluation interprets expressions. This skill processes or generates evaluable forms.
## Cat# Integration

This skill maps to **Cat# = Comod(P)** as a bicomodule in the equipment structure:

```
Trit: 0 (ERGODIC)
Home: Prof
Poly Op: ⊗
Kan Role: Adj
Color: #26D826
```

### GF(3) Naturality

The skill participates in triads satisfying:
```
(-1) + (0) + (+1) ≡ 0 (mod 3)
```

This ensures compositional coherence in the Cat# equipment structure.

Overview

This skill provides an interface to the GNU Scheme (Guile) interpreter for evaluating Scheme code, running scripts, and interacting with modules and the REPL. It exposes common CLI options, REPL usage patterns, and module loading so you can embed or orchestrate Scheme evaluation from Python-based workflows. The skill is designed for scientific and programmatic workflows that need a lightweight Scheme evaluator integrated into larger systems.

How this skill works

The skill wraps Guile’s execution model: it can start a REPL, evaluate expressions, call functions, load source files, and add load paths. It supports common command-line flags (-L, -l, -e, -c, -s) and programmatic evaluation of Scheme forms. It also exposes idiomatic module loading (use-modules) so callers can import SRFIs and ice-9 libraries and receive results back into the host environment.

When to use it

  • Embed Scheme evaluation into Python automation or pipelines
  • Prototype language features, macros, or interpreters using Guile’s eval/apply model
  • Run Scheme-based scientific scripts or reuse Scheme libraries from larger systems
  • Experiment with pattern matching, multi-value returns, and formatted output
  • Integrate with graph and bibliography resources in mixed-language workflows

Best practices

  • Use -L to add project-specific load paths and avoid global state conflicts
  • Load small, focused modules with use-modules to limit namespace pollution
  • Prefer -c for quick expression checks and -s for running self-contained scripts
  • Wrap long-running or interactive sessions in controlled REPL sessions to capture state
  • Serialize results with formatted output (ice-9 format) when exchanging data with Python

Example use cases

  • Evaluate Scheme expressions from a Python test harness to validate language-level behavior
  • Run Scheme-based scientific algorithms as part of a data analysis pipeline
  • Load and exercise SRFI libraries (srfi-1 list utilities) in automated integration tests
  • Use pattern matching and multi-value support to implement compact data-processing steps
  • Embed Guile for rapid prototyping of DSL interpreters that later port to other hosts

FAQ

Can I call Guile functions from Python and get back native values?

Yes. Use the skill to evaluate expressions that return serializable values (numbers, strings, lists) and format them for exchange. For complex objects, serialize in Scheme first (e.g., with format) before passing.

Which common modules are available?

Common Guile modules include SRFI libraries (srfi-1), ice-9 helpers (receive, match, format). Availability depends on the Guile installation and any added load paths.

How do I run a script non-interactively?

Use the -s <script> flag to execute a script file, or -c <expr> to evaluate a single expression. Combine -L and -l to prepare the environment before execution.