Skip to content

Instantly share code, notes, and snippets.

@samth
Created June 30, 2022 19:39
Show Gist options
  • Save samth/e02678940bc4090f592344432e92e4a7 to your computer and use it in GitHub Desktop.
Save samth/e02678940bc4090f592344432e92e4a7 to your computer and use it in GitHub Desktop.
#lang racket
(require (for-meta 2 racket/base racket/file))
(define-syntax (define-compile-time-bytes stx)
(syntax-case stx ()
[(_ id f)
#`(begin
(begin-for-syntax
(define-syntax (gen _)
(datum->syntax #'here (file->bytes f))))
(define-syntax (id stx)
#`(quote #,(gen))))]))
(define-compile-time-bytes x "/tmp/compile-time.rkt")
x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment