sigildocs

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

LibraryStatusNotes
(scheme base)Near-completeMissing dynamic-wind, include/include-ci
(scheme case-lambda)Completecase-lambda in prelude
(scheme char)CompleteFull classification, conversion, CI comparison
(scheme cxr)CompleteAll c...r combinations
(scheme eval)Completeeval
(scheme file)CompleteFile ports via (sigil io)
(scheme inexact)Completesqrt, trigonometric functions
(scheme lazy)Completedelay, force, promise?, make-promise
(scheme load)Completeload
(scheme process-context)Completecommand-line, exit, emergency-exit, env vars
(scheme read)Completeread
(scheme time)Completecurrent-second, current-jiffy, jiffies-per-second
(scheme write)Near-completewrite-shared not yet implemented

Import Modifiers

All R7RS import set modifiers are supported in both define-library and top-level import forms:

ModifierDescription
(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

FeatureStatus
if, cond, case, and, orSupported
let, let*, letrec, letrec*Supported
begin, do, when, unlessSupported
call/cc, call-with-current-continuationSupported
values, call-with-valuesSupported
let-values, let*-values, define-valuesSupported
guard, raise, raise-continuableSupported
with-exception-handlerSupported
dynamic-windNot implemented
cond-expandSupported
syntax-errorSupported
featuresSupported

Procedures

FeatureStatus
lambda, defineSupported
applySupported
map, for-each (multi-list)Supported
make-parameter, parameterizeSupported

Numeric

FeatureStatus
+, -, *, /Supported
=, <, >, <=, >=Supported
abs, quotient, remainder, moduloSupported
floor, ceiling, truncate, roundSupported
floor/, floor-quotient, floor-remainderSupported
truncate/, truncate-quotient, truncate-remainderSupported
max, min, gcd, lcmSupported
expt, sqrt, squareSupported
exp, log, sin, cos, tanSupported
asin, acos, atanSupported
exact, inexact, exact?, inexact?Supported
exact-integer?Supported
number->string, string->numberSupported

Lists and Pairs

FeatureStatus
cons, car, cdr, set-car!, set-cdr!Supported
pair?, null?, list?Supported
list, make-list, lengthSupported
append, reverse, list-tail, list-refSupported
list-set!, list-copySupported
memq, memv, memberSupported
assq, assv, assocSupported

Booleans and Symbols

FeatureStatus
not, boolean?, boolean=?Supported
symbol?, symbol=?Supported
symbol->string, string->symbolSupported

Strings

FeatureStatus
string, make-string, string-lengthSupported
string-ref, string-set!Supported
string=?, string<?, etc.Supported
string-upcase, string-downcase, string-foldcaseSupported
string-append, substringSupported
string->list, list->stringSupported
string-copy, string-copy!Supported
string-fill!Supported
string-map, string-for-eachSupported
vector->string, string->vectorSupported

Vectors

FeatureStatus
vector, make-vector, vector-lengthSupported
vector-ref, vector-set!Supported
vector->list, list->vectorSupported
vector-copy, vector-copy!Supported
vector-fill!Supported
vector-map, vector-for-eachSupported

Bytevectors

FeatureStatus
bytevector?, make-bytevector, bytevectorSupported
bytevector-lengthSupported
bytevector-u8-ref, bytevector-u8-set!Supported
bytevector-copy, bytevector-copy!Supported
bytevector-appendSupported
utf8->string, string->utf8Supported

Error Objects

FeatureStatus
errorSupported
error-object?Supported
error-object-messageSupported
error-object-irritantsSupported
error-object-typeSupported
file-error?, read-error?Supported

I/O

FeatureStatus
read-char, peek-char, write-charSupported
read-line, read-stringSupported
read-u8, peek-u8, write-u8Supported
read-bytevector, write-bytevectorSupported
write, display, newline, write-stringSupported
current-input-port, current-output-port, current-error-portSupported
open-input-file, open-output-fileSupported
close-port, close-input-port, close-output-portSupported
call-with-portSupported
open-input-string, open-output-string, get-output-stringSupported
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-portSupported
open-input-bytevector, open-output-bytevectorNot implemented
char-ready?, u8-ready?Not implemented

Records

FeatureStatus
define-record-typeSupported (SRFI-9 style)

Macros

FeatureStatus
define-syntax, syntax-rulesSupported
Procedural macros (lambda transformers)Supported
let-syntax, letrec-syntaxNot implemented

(scheme char) Coverage

FeatureStatus
char?Supported
char=?, char<?, char>?, char<=?, char>=?Supported
char->integer, integer->charSupported
char-alphabetic?, char-numeric?, char-whitespace?Supported
char-upper-case?, char-lower-case?Supported
char-upcase, char-downcase, char-foldcaseSupported
char-ci=?, char-ci<?, char-ci>?, char-ci<=?, char-ci>=?Supported
digit-valueSupported
string-upcase, string-downcase, string-foldcaseSupported
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 compliance
  • sigil - 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.