| name | chicken-scheme |
| description | Write, compile, debug, and package CHICKEN Scheme programs. Use this skill whenever the user mentions CHICKEN Scheme, call-cc.org, csc, csi, Scheme eggs, Scheme-to-C compilation, R5RS/R7RS Scheme, call/cc, continuations, SRFI, or wants help with any Scheme programming task using CHICKEN. Also trigger for questions about the CHICKEN FFI, C interop from Scheme, egg packaging, REPL usage, or scripting with csi. Even if the user just says "scheme" without specifying CHICKEN, use this skill if context suggests CHICKEN (e.g. they mention eggs, csc, chicken-install, or wiki.call-cc.org). DO NOT USE when: the user is working with another Scheme implementation (Racket, Guile, MIT Scheme, Gambit) — those have different module systems, package managers, and idioms.
|
CHICKEN Scheme Skill
CHICKEN is a Scheme-to-C compiler + interpreter. It produces portable, efficient C from Scheme source and supports R5RS / R7RS (via extension). The main commands are:
| Command | Purpose |
|---|
csi | Interactive interpreter (REPL) |
csc | Compiler driver (Scheme → C → native binary) |
chicken-install | Install eggs (libraries) |
chicken-status | List installed eggs |
chicken-uninstall | Remove an egg |
Quick-Start Workflow
;;; hello.scm
(import (chicken base))
(print "Hello, world!")
csi -s hello.scm
csc hello.scm
./hello
csc -shared hello.scm
Egg System (Libraries)
chicken-install srfi-1
chicken-install matchable
chicken-install http-client
chicken-install medea
REPL Tips (csi)
,? ; help
,l file ; load a file
,t expr ; time an expression
,d name ; describe a binding
,q ; quit
Enable readline: chicken-install breadline, then add to ~/.csirc:
(import breadline)
(current-input-port (make-readline-port))
Common Pitfalls
csc on Windows may conflict with the C# compiler — use a full path or rename.
- No
use in CHICKEN 5 — replace (use foo) with (import foo).
- Dynamic loading requires a shared library on the
CHICKEN_REPOSITORY_PATH.
call/cc is powerful but sharp — prefer high-level abstractions (threads, conditions) over raw continuations in application code.
- Unsafe mode (
-unsafe) disables all safety checks — only use for hot inner loops after profiling.
Integrated Example
Goal: a CLI tool that reads a JSON file and prints how many records it has.
;;; count.scm
(import (chicken base)
(chicken file) ; read-string
medea) ; egg: read-json — NOT (use medea)
(define data (with-input-from-file (car (command-line-arguments)) read-json))
(printf "~a records~%" (length data))
chicken-install medea
csc count.scm
./count records.json
The medea egg is pulled in with (import medea) — in CHICKEN 5 there is no use. csc
compiles to a native binary in one step; for quick iteration csi -s count.scm records.json
runs the same source interpreted.
Read On Demand
| Read When | File |
|---|
| Modules, imports, tail recursion, call/cc, macros, records | Core Language |
| Scripting, shebang, CLI tools, compiler flag examples, egg structure | Scripting & CLI |
| FFI: foreign-lambda, callbacks, C interop, embedding | FFI Guide |
| Egg authoring, testing, and publishing workflow | Egg System |