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

20 lines
463 B
Scheme
Raw Normal View History

2014-08-03 01:19:55 -04:00
(define-library (scheme eval)
2014-09-08 07:20:08 -04:00
(import (picrin base))
2014-08-03 01:19:55 -04:00
2016-02-06 14:23:46 -05:00
(define counter 0)
(define-syntax (inc! n)
#`(set! #,n (+ #,n 1)))
(define (number->symbol n)
(string->symbol (number->string n)))
(define (environment specs)
(let ((library-name `(picrin @@my-environment ,(number->symbol counter))))
(inc! counter)
(let ((lib (make-library library-name)))
(eval `(import ,@specs) lib)
lib)))
2014-08-03 01:19:55 -04:00
2014-09-08 07:20:08 -04:00
(export environment eval))