) exports imports code))))))

    (syntax-case stx ()
      ((_ name decl ...)
       (call-with-values (lambda ()
                           (partition-decls #'(decl ...) '() '() '()))
         (lambda (exports imports code)
           #`(library name
               (export . #,exports)
               (import . #,imports)
               . #,code)))))))
