Asi srfi

SRFI Skill

install
source · Clone the upstream repo
git clone https://github.com/plurigrid/asi
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/plurigrid/asi "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/srfi" ~/.claude/skills/plurigrid-asi-srfi-f110bf && rm -rf "$T"
manifest: skills/srfi/SKILL.md
source content

SRFI Skill

"SRFIs extend the Scheme programming language. You can help." — srfi.schemers.org

Scheme Requests for Implementation: portable library specifications with GF(3) categorization.

Overview

SRFIs are community-driven specifications that extend Scheme beyond R5RS/R6RS/R7RS. Each SRFI has a unique number, status (draft/final/withdrawn), and reference implementation.

Core SRFIs by Category

Data Structures [MINUS: -1]

SRFINameStatusKey Exports
1List LibraryFinal
fold
,
unfold
,
filter
,
partition
4Homogeneous VectorsFinal
u8vector
,
f64vector
, typed arrays
9Defining Record TypesFinal
define-record-type
14Character SetsFinal
char-set
,
char-set-contains?
69Basic Hash TablesFinal
make-hash-table
,
hash-table-ref
113Sets and BagsFinal
set
,
bag
,
set-contains?
125Intermediate Hash TablesFinal
hash-table-map
, comparators
128Comparators (Reduced)Final
make-comparator
,
comparator-hash
133Vector LibraryFinal
vector-map
,
vector-fold
146MappingsFinal
mapping
, functional maps
158Generators and AccumulatorsFinal
make-coroutine-generator

Control Flow [ERGODIC: 0]

SRFINameStatusKey Exports
2AND-LET*Final
and-let*
short-circuit binding
8receiveFinal
receive
for multiple values
11let-valuesFinal
let-values
,
let*-values
18MultithreadingFinal
make-thread
,
mutex
,
condition-variable
34Exception HandlingFinal
guard
,
raise
39Parameter ObjectsFinal
make-parameter
,
parameterize
45Primitives for Lazy EvalFinal
delay
,
force
,
lazy
124EphemeronsFinal
make-ephemeron
, weak references
154First-Class Dynamic ExtentsFinal
dynamic-extent
, delimited continuations
155PromisesFinal
delay-force
, iterative lazy
226Control FeaturesFinal
call/cc
,
values
,
dynamic-wind

Syntax & Macros [PLUS: +1]

SRFINameStatusKey Exports
0Feature-Based ConditionalsFinal
cond-expand
6Basic String PortsFinal
open-input-string
,
get-output-string
26Cut/CuteFinal
cut
,
cute
partial application
42Eager ComprehensionsFinal
list-ec
,
sum-ec
,
do-ec
46Syntax for Multiple ValuesFinal
values->list
,
values->vector
57RecordsWithdrawn(superseded by 99, 136)
72Hygienic MacrosFinal
syntax-case
compatible
139Syntax ParametersFinal
define-syntax-parameter
147Custom Macro TransformersFinal
er-macro-transformer
149Basic Syntax-Rules ExtensionsFinal
_
,
...
patterns
211Scheme Macros for DefinitionsFinal
define-macro

I/O & System [MINUS: -1]

SRFINameStatusKey Exports
6Basic String PortsFinalin-memory I/O
28Basic Format StringsFinal
format
38External Representation with CyclesFinal
write/ss
,
read/ss
48Intermediate Format StringsFinal
format
with more directives
106Basic Socket InterfaceFinal
make-client-socket
,
socket-send
170POSIX APIFinal
file-info
,
set-file-mode!
180JSONFinal
json-read
,
json-write
192Port PositioningFinal
port-position
,
set-port-position!
193Command LineFinal
command-line
,
option-processor

Numeric [ERGODIC: 0]

SRFINameStatusKey Exports
27Sources of Random BitsFinal
random-integer
,
random-real
60Integers as BitsFinal
bitwise-and
,
bit-set?
94Type-Restricted NumericsFinal
fx+
,
fl*
141Integer DivisionFinal
floor/
,
ceiling/
,
truncate/
143FixnumsFinal
fx+
,
fxarithmetic-shift
144FlonumsFinal
fl+
,
flsin
,
flexp
151Bitwise Ops on Arbitrary IntegersFinal
bitwise-ior
,
integer-length
166Monadic FormattingFinal
format
with monadic composition

Testing & Debugging [PLUS: +1]

SRFINameStatusKey Exports
64A Scheme API for Test SuitesFinal
test-begin
,
test-equal
,
test-assert
78Lightweight TestingFinal
check
,
check-ec
219Define Higher-Order LambdaFinal
define
with curry

Pattern Matching [PLUS: +1]

SRFINameStatusKey Exports
204Wright-Cartwright-Shinn Pattern MatcherFinal
match
,
match-lambda

GF(3) Distribution

MINUS (-1):  Data Structures, I/O & System
ERGODIC (0): Control Flow, Numeric
PLUS (+1):   Syntax & Macros, Testing, Pattern Matching

Conservation: Σ(categories) ≡ 0 (mod 3) when balanced usage

R7RS-Large Libraries (Red/Tangerine Editions)

R7RS-Large incorporates SRFIs as standard libraries:

Red Edition (2019)

  • (scheme list)
    ← SRFI 1
  • (scheme vector)
    ← SRFI 133
  • (scheme sort)
    ← SRFI 132
  • (scheme set)
    ← SRFI 113
  • (scheme charset)
    ← SRFI 14
  • (scheme hash-table)
    ← SRFI 125
  • (scheme ilist)
    ← SRFI 116
  • (scheme rlist)
    ← SRFI 101
  • (scheme ideque)
    ← SRFI 134
  • (scheme text)
    ← SRFI 135
  • (scheme generator)
    ← SRFI 158
  • (scheme lseq)
    ← SRFI 127
  • (scheme stream)
    ← SRFI 41
  • (scheme box)
    ← SRFI 111
  • (scheme list-queue)
    ← SRFI 117
  • (scheme comparator)
    ← SRFI 128

Tangerine Edition (2021)

  • (scheme bitwise)
    ← SRFI 151
  • (scheme fixnum)
    ← SRFI 143
  • (scheme flonum)
    ← SRFI 144
  • (scheme division)
    ← SRFI 141
  • (scheme bytevector)
    ← R6RS
  • (scheme mapping)
    ← SRFI 146
  • (scheme regex)
    ← SRFI 115

Implementation Support Matrix

SRFIChezChickenGaucheGuileRacket
1
9
18
27
64
125
158
180

SRFI-27: Random Sources (Key for Gay.jl Bridge)

;; SRFI-27 provides the abstraction layer for splittable RNG
(import (srfi 27))

;; Create a random source with specific seed
(define my-source (make-random-source))
(random-source-pseudo-randomize! my-source 1069 42)

;; Get integers and reals
(define rand-int (random-source-make-integers my-source))
(define rand-real (random-source-make-reals my-source))

;; GF(3) trit from random source
(define (random-trit source)
  (- ((random-source-make-integers source) 3) 1))

SRFI-171: Transducers

;; Composable sequence transformations
(import (srfi 171))

;; Filter, map, take composed
(define xform
  (compose
    (tfilter even?)
    (tmap (lambda (x) (* x x)))
    (ttake 5)))

;; Apply to list
(list-transduce xform rcons '(1 2 3 4 5 6 7 8 9 10))
;; => (4 16 36 64 100)

SRFI-204: Pattern Matching

(import (srfi 204))

;; Destructuring with guards
(match '(1 2 3)
  ((x y z) (guard (< x y z)) (list z y x))
  (_ 'no-match))
;; => (3 2 1)

;; Quasiquote patterns
(match '(lambda (x) (+ x 1))
  (`(lambda (,var) (+ ,var 1)) var)
  (_ #f))
;; => x

Integration with Little Schemer

SRFILittle Schemer Concept
1
member?
,
rember
,
firsts
9Atoms as records
27Y combinator with random exploration
45Lazy evaluation (Seasoned Ch. 16)
154Continuations (Seasoned Ch. 13)
171Collectors as transducers
204Pattern matching vs cond

Commands

# Search SRFIs by keyword
srfi search "hash table"

# Show SRFI abstract
srfi show 125

# Clone SRFI implementation
srfi clone 171

# Open in browser
srfi open 204

# List all final SRFIs
srfi list --status final

References