summaryrefslogtreecommitdiff
path: root/examples/safe/untrusted.scm
diff options
context:
space:
mode:
Diffstat (limited to 'examples/safe/untrusted.scm')
-rw-r--r--examples/safe/untrusted.scm33
1 files changed, 33 insertions, 0 deletions
diff --git a/examples/safe/untrusted.scm b/examples/safe/untrusted.scm
new file mode 100644
index 000000000..f3ae5fe97
--- /dev/null
+++ b/examples/safe/untrusted.scm
@@ -0,0 +1,33 @@
+;;; examples/safe/untrusted.scm -- Scheme file to be run in a safe
+;;; environment.
+
+;;; Commentary:
+
+;;; This is an example file to be evaluated by the `safe' program in
+;;; this directory.
+;;;
+;;; *Note* that the files in this directory are only suitable for
+;;; demonstration purposes, if you have to implement safe evaluation
+;;; mechanisms in important environments, you will have to do more
+;;; than shown here -- for example disabling input/output operations.
+
+;;; Author: Martin Grabmueller
+;;; Date: 2001-05-30
+
+;;; Code:
+
+;; fact -- the everlasting factorial function...
+;;
+(define (fact n)
+ (if (< n 2)
+ 1
+ (* n (fact (- n 1)))))
+
+;; Display the factorial of 0..9 to the terminal.
+;;
+(do ((x 0 (+ x 1)))
+ ((= x 11))
+ (display (fact x))
+ (newline))
+
+;;; End of file.