~peter-pearse/ubuntu/natty/guile-1.8/prop001

« back to all changes in this revision

Viewing changes to examples/safe/untrusted.scm

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Schepler
  • Date: 2006-11-09 03:11:16 UTC
  • Revision ID: james.westby@ubuntu.com-20061109031116-hu0q1jxqg12y6yeg
Tags: upstream-1.8.1+1
ImportĀ upstreamĀ versionĀ 1.8.1+1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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))
 
32
 
 
33
;;; End of file.