[r6rs-discuss] avoiding repetition in library definitions

From: Trent Buck <trentbuck>
Date: Mon Nov 13 13:39:13 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
Received on Mon Nov 13 2006 - 13:38:34 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:00 UTC