R7RS Compatibility
Sigil implements R7RS Small with practical extensions. This page documents what's supported, what's intentionally omitted, and any differences from standard behavior.
Supported Libraries
| Library | Status | Notes |
|---|---|---|
(scheme base) | Near-complete | Missing dynamic-wind, include/include-ci |
(scheme case-lambda) | Complete | case-lambda in prelude |
(scheme char) | Complete | Full classification, conversion, CI comparison |
(scheme cxr) | Complete | All c...r combinations |
(scheme eval) | Complete | eval |
(scheme file) | Complete | File ports via (sigil io) |
(scheme inexact) | Complete | sqrt, trigonometric functions |
(scheme lazy) | Complete | delay, force, promise?, make-promise |
(scheme load) | Complete | load |
(scheme process-context) | Complete | command-line, exit, emergency-exit, env vars |
(scheme read) | Complete | read |
(scheme time) | Complete | current-second, current-jiffy, jiffies-per-second |
(scheme write) | Near-complete | write-shared not yet implemented |
Import Modifiers
All R7RS import set modifiers are supported in both define-library and top-level import forms:
| Modifier | Description |
|---|---|
(only <import-set> <id> ...) | Import only the listed identifiers |
(except <import-set> <id> ...) | Import all except the listed identifiers |
(prefix <import-set> <prefix>) | Add a prefix to all imported names |
(rename <import-set> (<old> <new>) ...) | Rename specific identifiers |
Modifiers compose through nesting, e.g. (prefix (only (scheme base) car cdr) my-).
Intentionally Omitted
Sigil prioritizes practical utility over numeric tower completeness:
No Exact Rationals
Sigil has integers (fixnums) and floating-point numbers, but no rational number type:
;; Other Schemes:
(/ 1 3) ; => 1/3 (exact rational)
;; Sigil:
(/ 1 3) ; => 0.333... (inexact float)No Complex Numbers
The (scheme complex) library is not provided.
No R5RS Compatibility Library
The (scheme r5rs) library is not provided. Use (scheme base) instead.
(scheme base) Coverage
Control Flow
| Feature | Status |
|---|---|
if, cond, case, and, or | Supported |
let, let*, letrec, letrec* | Supported |
begin, do, when, unless | Supported |
call/cc, call-with-current-continuation | Supported |
values, call-with-values | Supported |
let-values, let*-values, define-values | Supported |
guard, raise, raise-continuable | Supported |
with-exception-handler | Supported |
dynamic-wind | Not implemented |
cond-expand | Supported |
syntax-error | Supported |
features | Supported |
Procedures
| Feature | Status |
|---|---|
lambda, define | Supported |
apply | Supported |
map, for-each (multi-list) | Supported |
make-parameter, parameterize | Supported |
Numeric
| Feature | Status |
|---|---|
+, -, *, / | Supported |
=, <, >, <=, >= | Supported |
abs, quotient, remainder, modulo | Supported |
floor, ceiling, truncate, round | Supported |
floor/, floor-quotient, floor-remainder | Supported |
truncate/, truncate-quotient, truncate-remainder | Supported |
max, min, gcd, lcm | Supported |
expt, sqrt, square | Supported |
exp, log, sin, cos, tan | Supported |
asin, acos, atan | Supported |
exact, inexact, exact?, inexact? | Supported |
exact-integer? | Supported |
number->string, string->number | Supported |
Lists and Pairs
| Feature | Status |
|---|---|
cons, car, cdr, set-car!, set-cdr! | Supported |
pair?, null?, list? | Supported |
list, make-list, length | Supported |
append, reverse, list-tail, list-ref | Supported |
list-set!, list-copy | Supported |
memq, memv, member | Supported |
assq, assv, assoc | Supported |
Booleans and Symbols
| Feature | Status |
|---|---|
not, boolean?, boolean=? | Supported |
symbol?, symbol=? | Supported |
symbol->string, string->symbol | Supported |
Strings
| Feature | Status |
|---|---|
string, make-string, string-length | Supported |
string-ref, string-set! | Supported |
string=?, string<?, etc. | Supported |
string-upcase, string-downcase, string-foldcase | Supported |
string-append, substring | Supported |
string->list, list->string | Supported |
string-copy, string-copy! | Supported |
string-fill! | Supported |
string-map, string-for-each | Supported |
vector->string, string->vector | Supported |
Vectors
| Feature | Status |
|---|---|
vector, make-vector, vector-length | Supported |
vector-ref, vector-set! | Supported |
vector->list, list->vector | Supported |
vector-copy, vector-copy! | Supported |
vector-fill! | Supported |
vector-map, vector-for-each | Supported |
Bytevectors
| Feature | Status |
|---|---|
bytevector?, make-bytevector, bytevector | Supported |
bytevector-length | Supported |
bytevector-u8-ref, bytevector-u8-set! | Supported |
bytevector-copy, bytevector-copy! | Supported |
bytevector-append | Supported |
utf8->string, string->utf8 | Supported |
Error Objects
| Feature | Status |
|---|---|
error | Supported |
error-object? | Supported |
error-object-message | Supported |
error-object-irritants | Supported |
error-object-type | Supported |
file-error?, read-error? | Supported |
I/O
| Feature | Status |
|---|---|
read-char, peek-char, write-char | Supported |
read-line, read-string | Supported |
read-u8, peek-u8, write-u8 | Supported |
read-bytevector, write-bytevector | Supported |
write, display, newline, write-string | Supported |
current-input-port, current-output-port, current-error-port | Supported |
open-input-file, open-output-file | Supported |
close-port, close-input-port, close-output-port | Supported |
call-with-port | Supported |
open-input-string, open-output-string, get-output-string | Supported |
input-port?, output-port?, textual-port?, binary-port?, port? | Supported |
port-open?, input-port-open?, output-port-open? | Supported |
eof-object, eof-object? | Supported |
flush-output-port | Supported |
open-input-bytevector, open-output-bytevector | Not implemented |
char-ready?, u8-ready? | Not implemented |
Records
| Feature | Status |
|---|---|
define-record-type | Supported (SRFI-9 style) |
Macros
| Feature | Status |
|---|---|
define-syntax, syntax-rules | Supported |
| Procedural macros (lambda transformers) | Supported |
let-syntax, letrec-syntax | Not implemented |
(scheme char) Coverage
| Feature | Status |
|---|---|
char? | Supported |
char=?, char<?, char>?, char<=?, char>=? | Supported |
char->integer, integer->char | Supported |
char-alphabetic?, char-numeric?, char-whitespace? | Supported |
char-upper-case?, char-lower-case? | Supported |
char-upcase, char-downcase, char-foldcase | Supported |
char-ci=?, char-ci<?, char-ci>?, char-ci<=?, char-ci>=? | Supported |
digit-value | Supported |
string-upcase, string-downcase, string-foldcase | Supported |
string-ci=?, string-ci<?, string-ci>?, string-ci<=?, string-ci>=? | Supported |
Feature Identifiers
The features procedure returns a list of supported feature identifiers for use with cond-expand:
(features)
; => (r7rs sigil linux posix unix x86-64 lp64 64bit little-endian)Available features:
r7rs- R7RS compliancesigil- Sigil implementation- Platform:
linux,darwin,windows,freebsd,openbsd,netbsd - POSIX:
posix,unix(on Unix-like systems) - Architecture:
x86-64,aarch64,arm,i386,riscv - Data model:
ilp32,lp64 - Word size:
32bit,64bit - Endianness:
little-endian,big-endian
Sigil Extensions
Sigil provides additional features beyond R7RS:
Pattern Matching
(import (sigil match))
(match value
((a b c) (list a b c))
((x . rest) rest)
(_ 'default))Keywords
Keyword arguments in procedures:
(define (greet name: "World" times: 1)
(do ((i 0 (+ i 1)))
((= i times))
(display "Hello, ")
(display name)
(newline)))
(greet name: "Sigil" times: 3)Additional Modules
(sigil core)- Extended list operations,filter-map,fold-left, etc.(sigil json)- JSON parsing and generation(sigil http)- HTTP client and server(sigil socket)- TCP/UDP networking(sigil process)- Process spawning(sigil path)- Path manipulation(sigil fs)- File system operations(sigil time)- Date and time(sigil channels)- CSP-style concurrency
See the Library Reference for complete documentation.
Porting from Other Schemes
From Guile
Guile modules map directly:
;; Guile
(use-modules (ice-9 match))
;; Sigil
(import (sigil match))From Racket
Racket's #lang is not supported. Convert to standard module syntax:
;; Racket
#lang racket
(define (foo x) x)
;; Sigil
(define-library (my-module)
(export foo)
(import (scheme base))
(begin
(define (foo x) x)))From Chicken
SRFI imports work similarly:
;; Both
(import (srfi srfi-1))Note: Only (srfi srfi-9) (records) is currently bundled. Other SRFIs can be added as packages.