Created
February 4, 2021 16:03
-
-
Save shhyou/726d0542aef45b13981173a334a0202c to your computer and use it in GitHub Desktop.
Print loaded modules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
(require racket/pretty) | |
(require syntax/parse) | |
(module sub racket/base | |
) | |
(require 'sub) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
(define (load-and-print path pre-loaded-libraries) | |
(define ns (make-base-namespace)) | |
(parameterize ([current-namespace ns]) | |
(for ([mod (in-list pre-loaded-libraries)]) | |
(dynamic-require mod #f))) | |
(define c (current-load/use-compiled)) | |
(parameterize ([current-namespace ns] | |
[current-load/use-compiled | |
(lambda (path modname) | |
(printf "path = ~s\n" path) | |
(c path modname))]) | |
(dynamic-require path #f))) | |
(printf "with racket preloaded:\n") | |
(load-and-print "example.rkt" '(racket)) | |
(printf "\nwith racket/base preloaded:\n") | |
(load-and-print "example.rkt" '()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment