[racket] Scoped require

From: Eli Barzilay (eli at barzilay.org)
Date: Mon Aug 22 09:04:20 EDT 2011

50 minutes ago, Maxim Romashchenko wrote:
> 
> --- my-module.rkt ---
> #lang racket
> (provide my-begin)
> 
> (define foo
>    ...
> ---------------------

You could do this:

  #lang racket
  (provide (rename-out [begin my-begin]))

and get what you want,

> --- main.rkt ---
> #lang racket
> (require "my-module.rkt")
> 
> (my-begin
>    (foo
>      ...
> -----------------

but it's probably easier to do this instead here:

  #lang racket
  (require (rename-in racket [begin my-begin]))

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Posted on the users mailing list.