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)
_________________________________________________
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users

Reply via email to