In the below example, can file "library.rkt" be changed (without splitting it up into two files), so that file "program.rkt" works without change? Is using "racket/load" the only way to keep "library.rkt" to one file like this?

;;;; FILE library.rkt
#lang racket/base

(require (for-syntax racket/base))

(define-for-syntax (my-syntax-util stx)
;; Pretend that "my-syntax-util" performs some big complicated processing,
  ;; which is useful both in the implementation of "my-own-syntax" and
  ;; also directly by users of this library.
  (quasisyntax/loc stx
    (cons 'my-syntax-util-was-here #,stx)))

(define-syntax (my-own-syntax stx)
  (syntax-case stx ()
    ((_ CONDITION VAL)
     (quasisyntax/loc stx
       (if CONDITION
           #,(my-syntax-util (syntax VAL))
           VAL)))))

(provide my-own-syntax
         my-syntax-util)


;;;; FILE program.rkt
#lang racket/base

(require "library.rkt")

(my-own-syntax (equal? "a" "a") 42)

(my-syntax-util #'id)


--
http://www.neilvandyke.org/
____________________
 Racket Users list:
 http://lists.racket-lang.org/users

Reply via email to