Code · 1 file
Sample Scheme File
R7RS Scheme with a record type. Every language sample implements the same small program so you can compare them side by side.
Scheme · 747 B
Sample Scheme file
An idiomatic Scheme example — the same customer program (or, for hardware languages, a small counter design) we offer in every language.
CC0 · free for any use · Verified by an independent tool · Report a problem
;;; Sample Scheme (R7RS) program — samplefiles.com
(import (scheme base) (scheme write))
(define-record-type customer
(make-customer id name balance)
customer?
(id customer-id)
(name customer-name)
(balance customer-balance))
(define (vip? c) (>= (customer-balance c) 10000))
(define (total-balance customers)
(apply + (map customer-balance customers)))
(define customers
(list (make-customer 1 "Ada" 12500)
(make-customer 2 "Grace" 830.5)
(make-customer 3 "Linus" 10000)))
(for-each
(lambda (c)
(display (customer-name c))
(display "\t")
(display (customer-balance c))File details
Download from the command line
curl -L -o sample.scm https://files.samplefiles.com/code/scm/sample.scmwget https://files.samplefiles.com/code/scm/sample.scmhttps://files.samplefiles.com/code/scm/sample.scmprintf '%s %s\n' 97ee1c392582c389796a381eb8b3480e3a627b813aa3a8c10f758bd18dc7fcd4 sample.scm | shasum -a 256 -cOr check the download in your browser with the checksum calculator.