Created
September 8, 2012 14:35
-
-
Save cslarsen/3675478 to your computer and use it in GitHub Desktop.
R7RS version of Celsius-Fahrenheit table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#| | |
| Celsius-Fahrenheit temperature table | |
| | |
| Taken from | |
| http://programmingpraxis.com/2012/09/07/the-first-two-programs/2/ | |
| | |
| Ported to current R7RS scheme by Christian Stigen Larsen | |
| Public Domain, 2012 | |
| | |
| Works in Mickey Scheme | |
| | |
| Since R7RS is under development, you have to make a few modifications to | |
| make it run under R7RS draft 6, i.e., in Chibi Scheme: | |
| | |
| - Import (scheme inexact) instead of (scheme math) | |
| - Call inexact->exact instead of exact | |
|# | |
(import (scheme write) | |
(scheme base) | |
(scheme math)) | |
(define (temp-table) | |
(do ((f 0 (+ f 20))) ((< 300 f)) | |
(display f) | |
(display #\tab) | |
(display (exact (round (* (- f 32) 5/9)))) | |
(newline))) | |
(temp-table) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The output is:
$ ./mickey test/celsius-fahrenheit.scm
0 -18
20 -7
40 4
60 16
80 27
100 38
120 49
140 60
160 71
180 82
200 93
220 104
240 116
260 127
280 138
300 149