[Larceny-users] Larceny basics

Dan Muresan danmbox at gmail.com
Sat Sep 1 13:06:22 EDT 2007


> Right.  My attempt to implement such a strategy is described on the 
> ExtendingRequire wiki page.  I came very close to getting it working, 
> but in the end I gave up because of cases like this:
> 
> (define-syntax foo
>   (syntax-rules ()
>     ((_) (require-at-expansion-time 'foo))))

I can't find read-file, so here's a simpler experiment based on your 
macro-expand approach:

;; loads all macros in a list of s-expressions
(define-syntax req-for-syn
   (syntax-rules ()
     ((_ file) (for-each macro-expand file))))

;; (foo x) => x
(req-for-syn
   `((define-syntax foo (syntax-rules () ((_ x) x)))))

 > (foo 1)
1

;; bar is an alias for req-for-syn
(req-for-syn
   `((define-syntax bar (syntax-rules () ((_ x) (req-for-syn x))))))


;; bar works
 > (bar `((define-syntax baz (syntax-rules () ((_ x) x)))))

 > (baz 1)
1


Best,
Dan



More information about the Larceny-users mailing list