untrusted.scm 789 B

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