[racket] Scribble question

From: Hari Prashanth (krhari at ccs.neu.edu)
Date: Fri Jul 2 18:42:36 EDT 2010

What am I missing? racket-map renders a red link...  

#lang scribble/manual
@(defmodule "vlist.ss")

@(require (for-label "vlist.ss")
          "doc-helper.rkt")

@defproc[(map ...) ...]{
Function @scheme[map] is similar to @|racket-map| for lists. }


;; doc-helper.rkt

#lang at-exp racket/base
(require scribble/manual
         (for-label racket/base))

(define racket-map @racket[map])
(provide racket-map)



----- Original Message -----
From: "Matthew Flatt" <mflatt at cs.utah.edu>
To: "Hari Prashanth" <krhari at ccs.neu.edu>
Cc: "plt-scheme" <users at lists.racket-lang.org>
Sent: Wednesday, June 30, 2010 5:02:46 PM GMT -05:00 US/Canada Eastern
Subject: Re: [racket] Scribble question

At Wed, 30 Jun 2010 15:21:19 -0400 (EDT), Hari Prashanth wrote:
> I have a function by name map. For its documentation, I have
> something like
> 
> @defproc[(map ...) (...)]{
> @scheme[map] is similar to @scheme[map]
> }
> 
> The want the latter @scheme[map] to refer map provided by lists.
> 
> How can I do that? Can someone help me out with this?

The simplest solution is to create a new module:

 ;; other.rkt:
 #lang at-exp racket/base
 (require scribble/manual
          (for-label racket/base))

 (define racket-map @racket[map])
 (provide racket-map)

And use it like this:

 #lang scribble/manual
 @(require (for-label lang/htdp-intermediate)
           "other.rkt")

 The ISL @racket[map] is similar to Racket's @|racket-map|.

If you want everything in one module, you can play a trick with
macro-introduced imports:

 #lang scribble/manual
 @(require (for-label lang/htdp-intermediate))

 @(begin
   (define-syntax-rule (def racket-map)
     (begin
       (require (for-label racket/base))
       (define racket-map @racket[map])))
   (def racket-map))

 The ISL @racket[map] is similar to Racket's @|racket-map|.

There should be a better way to do this --- maybe a macro that packages
up the macro-introduced-import trick.




Posted on the users mailing list.