Commit | Line | Data |
---|---|---|
2de7ddb7 MG |
1 | ;;; examples/safe/untrusted.scm -- Scheme file to be run in a safe |
2 | ;;; environment. | |
3 | ||
4 | ;;; Commentary: | |
5 | ||
6 | ;;; This is an example file to be evaluated by the `safe' program in | |
7 | ;;; this directory. | |
8 | ;;; | |
9 | ;;; *Note* that the files in this directory are only suitable for | |
10 | ;;; demonstration purposes, if you have to implement safe evaluation | |
11 | ;;; mechanisms in important environments, you will have to do more | |
12 | ;;; than shown here -- for example disabling input/output operations. | |
13 | ||
14 | ;;; Author: Martin Grabmueller | |
15 | ;;; Date: 2001-05-30 | |
16 | ||
17 | ;;; Code: | |
18 | ||
19 | ;; fact -- the everlasting factorial function... | |
20 | ;; | |
21 | (define (fact n) | |
22 | (if (< n 2) | |
23 | 1 | |
24 | (* n (fact (- n 1))))) | |
25 | ||
26 | ;; Display the factorial of 0..9 to the terminal. | |
27 | ;; | |
28 | (do ((x 0 (+ x 1))) | |
29 | ((= x 11)) | |
30 | (display (fact x)) | |
31 | (newline)) | |
673509f8 MG |
32 | |
33 | ;;; End of file. |