Skip to content

Instantly share code, notes, and snippets.

@samth
Created June 30, 2022 19:39
Embed
What would you like to do?
#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