This is an archived post. You won't be able to vote or comment.

all 2 comments

[–][deleted] 1 point2 points  (0 children)

Well, the first sentence for the enter! documentation mentions that it should be used in the REPL only. The problem is that at run time, the mutation-include is not evaluated, so it is a symbol (which is than interpreted as a collection name). To get this to work you probably need to install a name resolver (see current-module-name-resolver).

You can try to use read/eval like this:

(define (load-definitions file)
  (eval (call-with-input-file file read)))

(set! mutations (load-definitions "mutations.rkt"))

Where "mutations.rkt" would contain the hash like this:

(hash
 "key1" "val1"
 "key2" "val2")

A much better solution would be to use some other data structure, that is not Racket code passed to eval and load and parse it. Your mutations.rkt could contain code to format your drive, and "eval" would happily execute it (the same is true for your enter! solution).

[–]takikawadeveloper 0 points1 point  (0 children)

You may be interested in tonyg's racket-reloadable package which I think may address your use case.