[racket-dev] Providing macro definitions for BSL programs

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sat Sep 4 16:42:26 EDT 2010

You need to define and export -> . Otherwise students don't have access to the specific -> in your macro. 

BTW, injecting macros into *sl languages demands a lot of error checking because novices are easily confused. 




On Sep 4, 2010, at 4:37 PM, Nadeem Abdul Hamid wrote:

> Suppose I make a "teachpack" that defines a macro:
> 
> #lang racket
> ...
> (define-syntax (my-macro stx)
>  (syntax-case stx (->)
>    [(_ (func arg ...) -> rslt)
>     #`(check-expect (func arg ...) rslt)]))
> (my-macro (+ 4 5) -> 10)
> (test)
> (provide my-macro)
> 
> Running this file works fine.
> 
> Now, how exactly do I make this macro available to programs written in
> Beginning/Intermediate Student? Opening up a file in BSL level and
> typing:
>  (require "my-macro.rkt")
>  (my-macro (+ 4 5) -> 9)
> gives the error:
>  my-macro: bad syntax
> 
> This macro is a simplification of the real thing I'm working on, but
> note that the arguments to this macro include name(s) of functions
> defined in the BSL file. I though of maybe using
> provide-higher-order-primitive, but it doesn't seem to work either.
> 
> --- nadeem
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/dev



Posted on the dev mailing list.