From 77d5cacbff159318a00c28d0773fe81bd11fdf6f Mon Sep 17 00:00:00 2001 From: Sam Tobin-Hochstadt Date: Wed, 8 Aug 2012 11:09:25 -0400 Subject: [PATCH] Add examples for `collapse-module-path`. --- collects/syntax/scribblings/modcollapse.scrbl | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/collects/syntax/scribblings/modcollapse.scrbl b/collects/syntax/scribblings/modcollapse.scrbl index 5a87b83226..8ad12674e5 100644 --- a/collects/syntax/scribblings/modcollapse.scrbl +++ b/collects/syntax/scribblings/modcollapse.scrbl @@ -1,5 +1,13 @@ #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} @@ -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 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.} +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?] [rel-to-module-path-v (or/c module-path?