diff options
| author | 2025-10-28 19:13:59 -0400 | |
|---|---|---|
| committer | 2025-10-28 19:13:59 -0400 | |
| commit | 56dccf1e771f20252e9492e254c368d3f9330db6 (patch) | |
| tree | a4ca4a6ebd7738079244f38231b85c9cc761253e /mcgoron/guix/srfi.scm | |
| parent | try vicare (diff) | |
portable r7rs srfi-1
Diffstat (limited to '')
| -rw-r--r-- | mcgoron/guix/srfi.scm | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/mcgoron/guix/srfi.scm b/mcgoron/guix/srfi.scm new file mode 100644 index 0000000..0f9d71e --- /dev/null +++ b/mcgoron/guix/srfi.scm @@ -0,0 +1,106 @@ +#| Copyright (C) 2025 Peter McGoron + | + | This program is free software: you can redistribute it and/or modify it + | under the terms of the GNU General Public License as published by the + | Free Software Foundation, either version 3 of the License, or (at your + | option) any later version. + | + | This program is distributed in the hope that it will be useful, but + | WITHOUT ANY WARRANTY; without even the implied warranty of + | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + | General Public License for more details. + | + | You should have received a copy of the GNU General Public License along + | with this program. If not, see <https://www.gnu.org/licenses/>. + |# + +(define-module (mcgoron guix srfi) + #:use-module (rnrs base) + #:use-module (guix packages) + #:use-module (guix utils) + #:use-module (gnu packages) + #:use-module (guix licenses) + #:use-module (guix git-download) + #:use-module (guix download) + #:use-module (guix build-system gnu) + #:use-module (guix build-system) + #:use-module (guix build-system copy) + #:use-module (guix build-system trivial) + #:use-module (guix build-system cmake) + #:use-module (mcgoron guix scheme-packages) + #:use-module (guix gexp)) + +(define-public srfi-1-r7rs + (package + (name "srfi-1-r7rs") + (version "errata-7") + (source + (origin (method git-fetch) + (uri (git-reference (url "https://github.com/scheme-requests-for-implementation/srfi-1") + (commit "errata-7"))) + (sha256 (base32 "18lj5y85zxs0yzkdv66qd290nwms7jy27ky1x3ba9kp6hzjia5kj")))) + (build-system copy-build-system) + (home-page "https://srfi.schemers.org/srfi-1") + (synopsis "List library (R7RS)") + (license (non-copyleft "//srfi.schemers.org/srfi-1/srfi-1.html")) + (inputs '()) + (native-inputs '()) + (description " R5RS Scheme has an impoverished set of list-processing utilities, which is a problem for authors of portable code. This SRFI proposes a coherent and comprehensive set of list-processing procedures; it is accompanied by a reference implementation of the spec. The reference implementation is + + portable + efficient + completely open, public-domain source +") + (arguments + (list + #:phases + #~ (modify-phases %standard-phases + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (use-modules (rnrs io ports)) + (let ((lib (string-append (assoc-ref %outputs "out") + "/" #$r7rs-lib-dir + "/srfi"))) + (mkdir-p lib) + (with-output-to-file (string-append lib "/1.sld") + (lambda () + (display "(define-library (srfi 1) (import (scheme base) (scheme cxr))\n") + (write + '(export + xcons make-list list-tabulate cons* list-copy + proper-list? circular-list? dotted-list? not-pair? null-list? list= + circular-list length+ + iota + first second third fourth fifth sixth seventh eighth ninth tenth + car+cdr + take drop + take-right drop-right + take! drop-right! + split-at split-at! + last last-pair + zip unzip1 unzip2 unzip3 unzip4 unzip5 + count + append! append-reverse append-reverse! concatenate concatenate! + unfold fold pair-fold reduce + unfold-right fold-right pair-fold-right reduce-right + append-map append-map! map! pair-for-each filter-map map-in-order + filter partition remove + filter! partition! remove! + find find-tail any every list-index + take-while drop-while take-while! + span break span! break! + delete delete! + alist-cons alist-copy + delete-duplicates delete-duplicates! + alist-delete alist-delete! + reverse! + lset<= lset= lset-adjoin + lset-union lset-intersection lset-difference lset-xor lset-diff+intersection + lset-union! lset-intersection! lset-difference! lset-xor! lset-diff+intersection! + map for-each member assoc)) + (display "\n(begin\n") + (do ((f (open-input-file "srfi-1-reference.scm")) + (s "" (get-line f))) + ((eof-object? s)) + (display s) (newline)) + (display "))\n")))))))))))
\ No newline at end of file |
