Defining a "purely functional" R5RS env

94 views Asked by At

To the Racket specialists, if I run this code, can I assure that everything next will be deterministic and purely functional? Or am I missing something?

#lang r5rs

(define-syntax
  unsafe (syntax-rules ()
           ((_ fn ...)
            (begin
              (define fn #f)
              ...))))

(unsafe
 ...
 call-with-input-file
 call-with-output-file
 close-input-port
 close-output-port
 current-input-port
 current-output-port
 display
 eval
 interaction-environment
 load
 newline
 null-environment
 open-input-file
 open-output-file
 peek-char
 read
 read-char
 scheme-report-environment
 set-car!
 set-cdr!
 transcript-off
 transcript-on
 vector-fill!
 vector-set!
 with-input-from-file
 with-output-to-file
 write
 write-char)

; Remove dangerous macros "let-syntax" and "set!"
(define-syntax
  let-syntax (syntax-rules ()
          ((_ ...)
           #f)))

(define-syntax
  set! (syntax-rules ()
          ((_ ...)
           #f)))

; Remove define-syntax itself
(define-syntax
  define-syntax (syntax-rules ()
          ((_ ...)
           #f)))
0

There are 0 answers