[r6rs-discuss] avoiding repetition in library definitions

Trent Buck trentbuck at gmail.com
Mon Nov 13 13:38:34 EST 2006


Is it possible to (R5.91RS portably) abstract over repetition in
library definitions?

For example, suppose I had

        (library (Text ParserCombinators Parsec (1 0 3))
             (import (Text ParserCombinators Parsec Pos (1 0 3))
                     (Text ParserCombinators Parsec Error (1 0 3))
                     (Text ParserCombinators Parsec Prim (1 0 3))
                     (Text ParserCombinators Parsec Combinator (1 0 3))
                     (Text ParserCombinators Parsec Char (1 0 3)))
             (export ...))

Contains an awful lot of repetition.  Something like

    (let-syntax ((library* 
                  (syntax-rules ()
                    [(library* (x ...) y (z ...) body ...)
                     (library (x ... y)
                              (import (x ... y z) ...)
                       body ...)])))
      (library* (Text ParserCombinators Parsec)
                (1 0 3)
                (Pos Error Prim Combinator Char)
                (export ...)))

would be nice.
--
Trent Buck, Student Errant



More information about the r6rs-discuss mailing list