2014-08-03 01:19:55 -04:00
|
|
|
(define-library (scheme eval)
|
2017-04-03 13:16:18 -04:00
|
|
|
(import (picrin base)
|
|
|
|
(picrin macro))
|
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)))
|
|
|
|
|
2016-02-06 14:54:55 -05:00
|
|
|
(define (environment . specs)
|
2017-04-02 11:37:37 -04:00
|
|
|
(let ((lib (string->symbol
|
|
|
|
(string-append "picrin.@@my-environment." (number->string counter)))))
|
2016-02-06 14:23:46 -05:00
|
|
|
(inc! counter)
|
2016-02-18 03:39:32 -05:00
|
|
|
(make-library lib)
|
2017-04-02 11:37:37 -04:00
|
|
|
(parameterize ((current-library lib))
|
|
|
|
(eval `(import ,@specs) lib))
|
2016-02-18 03:39:32 -05:00
|
|
|
lib))
|
2014-08-03 01:19:55 -04:00
|
|
|
|
2014-09-08 07:20:08 -04:00
|
|
|
(export environment eval))
|