Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

R7RS version of Celsius-Fahrenheit table

View celsius-fahrenheit.scm
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
#|
| 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)
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.