All SRFI library-name imports on one web page
Lassi Kortela 18 Jul 2021 09:59 UTC
Could srfi-common generate an extra web page that lists all the R6RS
library name imports at once?
Here's code to make the list based on srfi-data.scm:
;;----------------------------------------------------------------------------
(import (rnrs))
(define (writeln x) (write x) (newline))
(define (read-all)
(let loop ((xs '()))
(let ((x (read)))
(if (eof-object? x) (reverse xs) (loop (cons x xs))))))
(define (filter-map f xs) ; From SRFI 1.
(let loop ((acc '()) (xs xs))
(if (null? xs) (reverse acc)
(let ((x (f (car xs))))
(loop (if x (cons x acc) acc) (cdr xs))))))
(define srfi-data (with-input-from-file "admin/srfi-data.scm" read-all))
(define (get-one entry)
(if (and entry (= 2 (length entry))) (cadr entry) (error #f "Huh?")))
(define (srfi-number srfi)
(get-one (assq 'number srfi)))
(define (srfi-library-name srfi)
(let ((entry (assq 'library-name srfi)))
(and entry (get-one entry))))
(define (srfi->import srfi)
(let ((name (srfi-library-name srfi)))
(and name
`(import (srfi
,(string->symbol
(string-append ":" (number->string (srfi-number
srfi))))
,name)))))
(for-each writeln (filter-map srfi->import srfi-data))
;;----------------------------------------------------------------------------
The output is:
(import (srfi :0 cond-expand))
(import (srfi :1 lists))
(import (srfi :2 and-let*))
(import (srfi :4 numeric-vectors))
(import (srfi :5 let))
(import (srfi :6 basic-string-ports))
(import (srfi :8 receive))
(import (srfi :9 records))
(import (srfi :11 let-values))
(import (srfi :13 strings))
(import (srfi :14 char-sets))
(import (srfi :16 case-lambda))
(import (srfi :17 generalized-set!))
(import (srfi :18 multithreading))
(import (srfi :19 time))
(import (srfi :21 real-time-multithreading))
(import (srfi :23 error))
(import (srfi :25 multi-dimensional-arrays))
(import (srfi :26 cut))
(import (srfi :27 random-bits))
(import (srfi :28 basic-format-strings))
(import (srfi :29 localization))
(import (srfi :31 rec))
(import (srfi :34 exception-handling))
(import (srfi :35 conditions))
(import (srfi :37 args-fold))
(import (srfi :38 with-shared-structure))
(import (srfi :39 parameters))
(import (srfi :41 streams))
(import (srfi :42 eager-comprehensions))
(import (srfi :43 vectors))
(import (srfi :44 collections))
(import (srfi :45 lazy))
(import (srfi :46 syntax-rules))
(import (srfi :47 arrays))
(import (srfi :48 intermediate-format-strings))
(import (srfi :51 rest-values))
(import (srfi :54 cat))
(import (srfi :57 records))
(import (srfi :59 vicinities))
(import (srfi :60 integer-bits))
(import (srfi :61 cond))
(import (srfi :63 arrays))
(import (srfi :64 testing))
(import (srfi :66 octet-vectors))
(import (srfi :67 compare-procedures))
(import (srfi :69 basic-hash-tables))
(import (srfi :71 let))
(import (srfi :74 blobs))
(import (srfi :78 lightweight-testing))
(import (srfi :86 mu-and-nu))
(import (srfi :87 case))
(import (srfi :95 sorting-and-merging))
(import (srfi :98 os-environment-variables))
(import (srfi :99 records))
(import (srfi :115 regex))
(import (srfi :117 list-queues))
(import (srfi :125 hashtables))
(import (srfi :126 r6rs-hashtables))
(import (srfi :127 lazy-sequences))
(import (srfi :128 comparators))
(import (srfi :129 titlecase))
(import (srfi :130 string-cursors))
(import (srfi :131 records))
(import (srfi :132 sorting))
(import (srfi :133 vectors))
(import (srfi :141 integer-division))
(import (srfi :143 fixnums))
(import (srfi :145 assume))
(import (srfi :151 bitwise-operations))
(import (srfi :152 strings))
(import (srfi :156 predicate-combiners))
(import (srfi :158 generators-and-accumulators))
(import (srfi :175 ascii))