picrin/contrib/20.r7rs/scheme/eval.scm

19 lines
453 B
Scheme

(define-library (scheme eval)
(import (picrin base))
(define counter 0)
(define-syntax (inc! n)
#`(set! #,n (+ #,n 1)))
(define (environment . specs)
(let ((lib (string->symbol
(string-append "picrin.@@my-environment." (number->string counter)))))
(inc! counter)
(make-library lib)
(parameterize ((current-library lib))
(eval `(import ,@specs) lib))
lib))
(export environment eval))