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)))
|
|
|
|
|
2016-02-06 14:54:55 -05:00
|
|
|
(define (environment . specs)
|
2016-02-06 14:23:46 -05:00
|
|
|
(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))
|