[racket] Evaluation at compile time
Hi all,
I would like to read in a JSON file at compile time, converting it to
SJSON, to avoid doing so at runtime. Here's what I've come up with so
far. Is there a more elegant way? Perhaps an (at-compile-time <expr>)
form? -- Tony
#lang racket
(require (for-syntax "json-parsing.ss")) ;; Thanks, Neil!
(define-syntax loaded-uci-descriptions
(lambda (stx)
(syntax-case stx ()
((_) #`(quote #,(call-with-input-file "uci-descriptions.js"
(lambda (f) (json->sjson f))))))))
(define uci-descriptions (loaded-uci-descriptions))
(provide uci-descriptions)