SchemeOld Interpreter
Aus ProgrammingWiki
Wiki-Quelltext dieser Seite.
<language>Scheme</language>
Programming Wiki verwendet den SISC Scheme Interpreter.
SISC is an extensible Java based interpreter of the algorithmic language Scheme. SISC uses modern interpretation techniques, and handily outperforms all existing JVM interpreters (often by more than an order of magnitude).
== Weblinks ==
* [http://sisc-scheme.org/ Homepage]
* [http://sisc-scheme.org/documentation.php Dokumentation]
* [http://sisc-scheme.org/wiki/ SISC Wiki]
== SRFI Modules ==
The Scheme Requests For Implementation (SRFI) process aims to coordinate libraries and other additions to the Scheme language between different Scheme implementations. For details see [http://srfi.schemers.org/ http://srfi.schemers.org/] which describes the process and contains a [http://srfi.schemers.org/final-srfis.html list] of all available SRFIs.
RFI's module definition may be loaded with the expression (require-library 'sisc/libs/srfi/srfi-n), where n is the SRFI's number.
SISC currently supports SRFIs 0, 1, 2, 5, 6, 7, 8, 9, 11, 13, 14, 16, 18, 19, 22, 23, 25, 26, 27, 28, 29, 30, 31, 34, 35, 37, 38, 39, 40, 42, 43, 45, 48, 51, 54, 55, 59, 60, 61, 62, 66, 67, 69 and 78.
<run id="4b926f8ea50e8">
(require-library 'sisc/libs/srfi/srfi-19)
(import srfi-19)
(time-second (current-time))
</run>
<run id="4b9275e53bc83">
(require-library 'sisc/libs/srfi/srfi-13)
(import srfi-13)
(string-length "Hallo Welt")
</run>
<code id="4ba13acf4260f">
;;; Zufallszahlgenerator
(define random-maker
(let* ((multiplier 48271)
(modulus 2147483647)
(apply-congruence
(lambda (current-seed)
(let ((candidate (modulo (* current-seed multiplier) modulus)))
(if (zero? candidate)
modulus
candidate))))
(coerce
(lambda (proposed-seed)
(if (integer? proposed-seed)
(- modulus (modulo proposed-seed modulus))
19860617)))) ;; an arbitrarily chosen birthday
(lambda (initial-seed)
(let ((seed (coerce initial-seed)))
(lambda args
(cond ((null? args)
(set! seed (apply-congruence seed))
(/ (- modulus seed) modulus))
((null? (cdr args))
(let* ((proposed-top
(ceiling (abs (car args))))
(exact-top
(if (inexact? proposed-top)
(inexact->exact proposed-top)
proposed-top))
(top
(if (zero? exact-top)
1
exact-top)))
(set! seed (apply-congruence seed))
(inexact->exact (floor (* top (/ seed modulus))))))
((eq? (cadr args) 'reset)
(set! seed (coerce (car args))))
(else
(display "random: unrecognized message")
(newline))))))))
;(define random
; (let ((seed (time-nanosecond (current-time))))
; (display seed)
; (random-maker seed)))
(require-library 'sisc/libs/srfi/srfi-19)
(import srfi-19) ; stellt current-time usw. bereit
(define random (random-maker (time-nanosecond (current-time))))
</code>
<run id="4ba13acf43224">(random 10)</run>