Add examples for collapse-module-path.

This commit is contained in:
Sam Tobin-Hochstadt 2012-08-08 11:09:25 -04:00
parent 3876dfa841
commit 77d5cacbff

View File

@ -1,5 +1,13 @@
#lang scribble/doc #lang scribble/doc
@(require "common.rkt" (for-label syntax/modcollapse)) @(require "common.rkt" scribble/eval
(for-label syntax/modcollapse))
@(define (new-evaluator)
(let* ([e (make-base-eval)])
(e '(require (for-syntax racket/base) syntax/modcollapse))
e))
@(define evaluator (new-evaluator))
@title[#:tag "modcollapse"]{Simplifying Module Paths} @title[#:tag "modcollapse"]{Simplifying Module Paths}
@ -31,7 +39,15 @@ is normalized so that equivalent module paths are represented by
@racket[equal?] results. When the result is a @racket['submod] module @racket[equal?] results. When the result is a @racket['submod] module
path, it contains only symbols after the base module path, and the path, it contains only symbols after the base module path, and the
base is normalized in the case of a @racket['lib] or @racket['planet] base is normalized in the case of a @racket['lib] or @racket['planet]
base.} base.
@examples[#:eval evaluator
(collapse-module-path "m.rkt" '(lib "n/main.rkt"))
(collapse-module-path '(submod "." x) '(lib "n/main.rkt"))
(collapse-module-path '(submod "." x) '(submod (lib "n/main.rkt") y))
]
}
@defproc[(collapse-module-path-index [module-path-index module-path-index?] @defproc[(collapse-module-path-index [module-path-index module-path-index?]
[rel-to-module-path-v (or/c module-path? [rel-to-module-path-v (or/c module-path?